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

How to access the results of previous time-steps during solution?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Hamedhoorijani
  • 1 Post By Aniy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 24, 2021, 06:10
Question How to access the results of previous time-steps during solution?
  #1
New Member
 
Hamed Hoorijani
Join Date: May 2019
Location: Gent, Belgium
Posts: 23
Rep Power: 7
Hamedhoorijani is on a distinguished road
Hi everyone,
I'm researching recurrence CFD and wanted to know does the OpenFOAM keeps the Fields and Scalar results of previous time steps during the solution or not? and If so how I can get access to each of these matrices that contain results during simulation?
In another word, What I need to know is, if the solver is at the 1000th time step of solution, is there a way to have access to the results of the 999 time steps before it?
I'll be grateful if you could guide me.
Many thanks
Shibi likes this.
Hamedhoorijani is offline   Reply With Quote

Old   July 25, 2021, 08:48
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
https://www.openfoam.com/documentati...tricField.html

Have a look at the functions storeoldtime und oldtime
mAlletto is offline   Reply With Quote

Old   July 26, 2021, 07:45
Default
  #3
New Member
 
Hamed Hoorijani
Join Date: May 2019
Location: Gent, Belgium
Posts: 23
Rep Power: 7
Hamedhoorijani is on a distinguished road
Thanks a lot dear Micheal for your response.
That was helpful actually. but I'm having a hard time finding how to use these functions of GeometricField class.

how should I call them in the solver?
Thanks
Hamedhoorijani is offline   Reply With Quote

Old   July 26, 2021, 08:44
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
Try to grep for it in the source code. I guess you will find some examples there
mAlletto is offline   Reply With Quote

Old   August 3, 2021, 09:46
Default
  #5
Senior Member
 
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 367
Rep Power: 8
geth03 is on a distinguished road
if you want to access the 999 previous timesteps out of 1000, you need to store them! as far as i know, openfoam saves the previous timestep values automatically, it would be insane to store every timestep, what kind of memory do you need for that when the problem is large?

i read your other question and i think you want to use a former timestep as initial value for the current time without interrupting the simulation.
if you already know which time step you will take as initial value than you could write a Allrun script that does it for you.
geth03 is offline   Reply With Quote

Old   August 9, 2021, 07:03
Default
  #6
New Member
 
Hamed Hoorijani
Join Date: May 2019
Location: Gent, Belgium
Posts: 23
Rep Power: 7
Hamedhoorijani is on a distinguished road
Hi, dear geth03,
Thanks a lot for your answer.
yeah at first I was looking for a way to store the values but as you mentioned, it's not a proper method to do so and it's not computationally efficient.
Now I want to do exactly as you said. I want to continue the solution of a problem until it reaches a time for instance time step (i) then if a set of conditions were met by the results then resume the solution with initial values of a previous time step for example time step (i-200).
I need to implement this in a solver's code. is this possible? and if so I'll appreciate if you could guide me.
Hamedhoorijani is offline   Reply With Quote

Old   August 9, 2021, 09:13
Default
  #7
New Member
 
Join Date: Feb 2021
Posts: 2
Rep Power: 0
Aniy is on a distinguished road
Hi, try <surfaceScalarField>.OldTimes().boundaryField()[myPatchID]

Add these two code lines:

const surfaceScalarField& phi = this->db().objectRegistry::lookupObject<surfaceScalarFi eld>("phi");
const label myPatchID = this->patch().boundaryMesh().findPatchID(patchName);

Then:

phi.nOldTimes().boundaryField()[myPatchID]

It returns the flow rate field from last iteration at user-defined patch. You can use this code to get to temperature field and so on.
Hamedhoorijani likes this.
Aniy is offline   Reply With Quote

Reply

Tags
openfoam, programing, solver development


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
courant number increases to rather large values 6863523 OpenFOAM Running, Solving & CFD 22 July 6, 2023 00:48
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 12:08
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 08:09
plot over time fferroni OpenFOAM Post-Processing 7 June 8, 2012 08:56
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58


All times are GMT -4. The time now is 11:27.