|
[Sponsors] |
How to access the results of previous time-steps during solution? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 24, 2021, 06:10 |
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 |
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 |
|
July 25, 2021, 08:48 |
|
#2 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
https://www.openfoam.com/documentati...tricField.html
Have a look at the functions storeoldtime und oldtime |
|
July 26, 2021, 07:45 |
|
#3 |
New Member
Hamed Hoorijani
Join Date: May 2019
Location: Gent, Belgium
Posts: 23
Rep Power: 7 |
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 |
|
July 26, 2021, 08:44 |
|
#4 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16 |
Try to grep for it in the source code. I guess you will find some examples there
|
|
August 3, 2021, 09:46 |
|
#5 |
Senior Member
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 369
Rep Power: 8 |
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. |
|
August 9, 2021, 07:03 |
|
#6 |
New Member
Hamed Hoorijani
Join Date: May 2019
Location: Gent, Belgium
Posts: 23
Rep Power: 7 |
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. |
|
August 9, 2021, 09:13 |
|
#7 |
New Member
Join Date: Feb 2021
Posts: 2
Rep Power: 0 |
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. |
|
Tags |
openfoam, programing, solver development |
|
|
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 |