CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Restart simulation at certain time step

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By arvindpj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 7, 2018, 12:51
Default Restart simulation at certain time step
  #1
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 8
cfdPack is on a distinguished road
Hello,

I'm quite new to OpenFOAM so for some of you the question might seem a bit trivial. I run my simulation parallel on 8 processors. My simulation stops at a certain point, so what I want to do now is start my simluation at that time step (with other setting) thus not having to begin at 0 again.
I tried using latestTime in my controlDict but my simulation still begins with 0. Do I have to decomomposePar or delete any directories before restart or what am I doing wrong?

Thanks in advance!
cfdPack is offline   Reply With Quote

Old   February 7, 2018, 17:55
Default
  #2
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 97
Rep Power: 15
arvindpj is on a distinguished road
When did you write data when you stop the solution, if so you can restart from latestTime else there is no solution to restart from.


Code:
writeControl    timeStep;
writeInterval   200;
Cheers,
Jay :-)
arvindpj is offline   Reply With Quote

Old   February 7, 2018, 20:04
Default
  #3
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 8
cfdPack is on a distinguished road
Thanks for your reply! I do write my data, part of my controlDict entry looks like this:

Code:
startFrom       latestTime;
startTime       0;
stopAt          endTime;
endTime         0.3;
deltaT          1e-6;
writeControl    adjustableRunTime;
writeInterval   0.01;
So after 0.01 a folder is created in my main case directory. Is this what you mean? As I mentioned before I run my simulation parallel, so in order to see my results in paraFoam I need to reconstruct my results, does this have something to do with my problem?
cfdPack is offline   Reply With Quote

Old   February 7, 2018, 20:41
Default
  #4
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 97
Rep Power: 15
arvindpj is on a distinguished road
You can restart from 0.01s only if the 0.01 data is already written. see inside the processor0 folder.

To view parallel results without reconstructing, open paraFoam with the following option

Code:
paraFoam -builtin
in paraFoam select the case as "Decomposed Case" (on the left panel)
arvindpj is offline   Reply With Quote

Old   February 7, 2018, 21:21
Default
  #5
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 8
cfdPack is on a distinguished road
Actually there are folders with the time steps within the processor* folders (in my case 0.01, 0.02 and 0.03). After running my simulation to the point it stopped I reconstructed all the data. And now I want to restart at 0.03. So I must not to delete my processor* folders?
cfdPack is offline   Reply With Quote

Old   February 7, 2018, 21:29
Default
  #6
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 97
Rep Power: 15
arvindpj is on a distinguished road
If you have reconstructed the data, you can go ahead and delete the processor* folders.

suppose you have data at 0.01 0.02 0.03s

you can either use "decomposePar -time 0.02", assuming you want to start at 0.02s and then start your runs.
nishant.kumar likes this.
arvindpj is offline   Reply With Quote

Old   February 9, 2018, 13:02
Default
  #7
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 8
cfdPack is on a distinguished road
Thanks for your help so far. I do follow your steps mentioned above. Furthermore I have an Allrun script which I use for starting the simulation after meshing, which is shown below:

Code:
#!/bin/sh

rm -r 0.*
rm -r processor*
rm -r logs

setFields | tee log.setfields

rm -r constant/polyMesh/refine*
rm -r patchtext
rm -r log*

decomposePar | tee log.decom

mpirun -np 8 interFoam -parallel > log 

#interDyMPatchFoam > log &

#reconstructParMesh

#reconstructPar

#rm -r processor*

#paraFoam
Do I have to remove steps such as
Code:
rm -r 0.*
in order to run the simulation from my desired time step? When I decompose at a desired time (e.g. 0.02s) and use my original Allrun script it will throw an error. I'm sorry if my questions seem a bit dumb :P
cfdPack is offline   Reply With Quote

Old   February 9, 2018, 13:21
Default
  #8
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 97
Rep Power: 15
arvindpj is on a distinguished road
Below are the comments on what the Allrun script does.


Code:
#!/bin/sh

# rm -r 0.*   // This removes all data folder starting with "0."
# rm -r processor*  // This removes all decomposed mesh and data folders, if you are restarting you need the data from these folders
rm -r logs 
rm -r logs

setFields | tee log.setfields

rm -r constant/polyMesh/refine*
rm -r patchtext
rm -r log*  // This removes logs
rm -r logs

# decomposePar | tee log.decom

mpirun -np 8 interFoam -parallel > log 

#interDyMPatchFoam > log &

#reconstructParMesh

#reconstructPar

#rm -r processor*

#paraFoam
Do I have to remove steps such as
[CODE]
arvindpj is offline   Reply With Quote

Old   February 9, 2018, 13:32
Default
  #9
New Member
 
Join Date: Feb 2018
Posts: 7
Rep Power: 8
cfdPack is on a distinguished road
Actually I'm clear about the commands you commented on in my Allrun script. But if I need the data in my processor* directories to restart at my desired time step, I should not follow your advice and delete the processor* folders, right? And deleting all my 0.* folders won't be good either as far as I understand?

So what I want to know is if I can use the Allrun script as it is to resume my simulation. I think not, but if I remove lines that remove the dircetories processor* and 0.* the code won't really function.
cfdPack is offline   Reply With Quote

Old   February 9, 2018, 13:45
Default
  #10
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 97
Rep Power: 15
arvindpj is on a distinguished road
Quote:
Originally Posted by cfdPack View Post
Actually I'm clear about the commands you commented on in my Allrun script. But if I need the data in my processor* directories to restart at my desired time step, I should not follow your advice and delete the processor* folders, right? And deleting all my 0.* folders won't be good either as far as I understand?

So what I want to know is if I can use the Allrun script as it is to resume my simulation. I think not, but if I remove lines that remove the directories processor* and 0.* the code won't really function.

I am not clear what you are trying to achieve.
Assuming, you plan to restart: You don't have to delete the 0.* folders and processor* (I have commented them out "#" in my previous post)
Also, you don't have to decompose the already decomposed case/data. So comment out the depcomposePar also.


Cheers:-
Jay

Last edited by arvindpj; February 9, 2018 at 15:49.
arvindpj is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
p_rgh initial residual no change with different settings manuc OpenFOAM Running, Solving & CFD 3 June 26, 2018 16:53
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 01:01
AMI interDyMFoam for mixer nu problem danny123 OpenFOAM Programming & Development 8 September 6, 2013 03:34
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 13:12.