# value of previous time step

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 8, 2013, 10:47 #21 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,251 Rep Power: 23 Sponsored Links oldTime and prevIter both are useful, nothing is deprecated. As stated by David, you can use oldTime to go back multiple time steps (not just one as prevIter), and it manages the storing automatically. That of course only works if you actually need values from a previous timestep, not from subcycle iterations. The latter case is where you would typically use prevIter/storePrevIter, but of course you can also use it to store data from a previous time step. - Anton dkxls likes this. __________________ *On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer.

 February 10, 2014, 18:16 #22 Member   Join Date: Feb 2012 Posts: 49 Rep Power: 7 Does U.oldTime() gives us the value of previous time step, or last value of the field? assume that we have this situation : while (runTime.loop()) { U = somevalue1 ; . . U = somevalue2 ; x = U.oldTime(); } So x is somevalue1 or is the value of U at the previous time step ?

 February 10, 2014, 21:10 #23 Senior Member   Mohammad Shakil Ahmmed Join Date: Oct 2012 Location: AUS Posts: 132 Rep Power: 7 U.oldTime() will give the values of U at previous time step.

March 7, 2015, 16:35
#24
Senior Member

Join Date: Jan 2013
Posts: 342
Rep Power: 7
Dear Marupio,

when "erased and reconstructed at every timestep" happens? At the beginning of each time step or at the end of the time step?

Thank you very much. OFFO

Quote:
 Originally Posted by marupio Yes, oldTime works much simpler than you think. It is all totally automatic in the background. You never need to call storeOldTime()... and the xn.oldTime() immediately gives you the value from the previous timestep. runTime is clever enough to count how many .oldTime()'s you use, and automatically stores that many in its database. I think you are probably using a local object. I was always confused as to why xn wouldn't *already* have the previous timestep's value at the start of the next timestep. If you are using a local object, it is erased and reconstructed at every timestep. In this case, oldTime() won't work, and neither would a simpler vectorField copy we talked about either. Where are you constructing your xn object? Will the program encounter the constructor once and only once throughout multiple timestep iterations? If not, move the constructor above your while(runTime.loop())... possibly even into createFields.H. If this is the problem, that's probably why it didn't work when you were using a standard vectorField. I'd recommend returning to the vectorField framework if possible.

 Tags field, store, time step

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post SD@TUB OpenFOAM Programming & Development 1 May 25, 2016 03:00 pUl| FLUENT 31 August 21, 2015 04:46 msrinath80 OpenFOAM Running, Solving & CFD 18 March 3, 2015 06:36 jpapg FLUENT 0 April 30, 2011 21:35 lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 15:09