|
[Sponsors] |
March 4, 2015, 19:24 |
When does OpenFOAM execute "storeOldTime" ?
|
#1 |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
Hi All,
I met a problem when I read the EulerDdtScheme.C Code:
https://github.com/OpenFOAM/OpenFOAM-2.2.x/blob/master/src/finiteVolume/finiteVolume/ddtSchemes/EulerDdtScheme/EulerDdtScheme.C Code:
rDeltaT*(rho*vf - rho.oldTime()*vf.oldTime()) I checked the source files for GeometricField.C, and found that there are indeed the functions for storeOldTimes: Code:
// Store old-time field template<class Type, template<class> class PatchField, class GeoMesh> void Foam::GeometricField<Type, PatchField, GeoMesh>::storeOldTimes() const { if ( field0Ptr_ && timeIndex_ != this->time().timeIndex() && !( this->name().size() > 2 && this->name()(this->name().size()-2, 2) == "_0" ) ) { storeOldTime(); } // Correct time index timeIndex_ = this->time().timeIndex(); } OFFO |
|
March 5, 2015, 10:50 |
|
#2 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
It happens on-demand, whenever you invoke 'field.oldTime()'
If you look at the 'GeometricField:ldTime()' member function, it checks for the existence of field0Ptr_, and creates one if it doesn't exist. From that point on, it is updated on access only if the time-step has changed (by checking the value of timeIndex_, which is incremented every time-step) |
|
March 5, 2015, 10:58 |
|
#3 | |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
Thank you, deepsterblue. I have not found a place where field.oldTime() is invoked. Could you please give me an example in it? Thank you very much. This is also my question so that I cannot understand when the old fields are stored in running OpenFOAM solvers.
OFFO Quote:
|
||
March 5, 2015, 11:03 |
|
#4 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
You gave the example yourself - in your original post. When you have:
Code:
rho.oldTime() * vf.oldTime() |
|
March 5, 2015, 11:31 |
|
#5 |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
Thank you. Since the following is from the Euler time scheme:
Code:
rDeltaT*(rho*vf - rho.oldTime()*vf.oldTime()) |
|
March 5, 2015, 18:42 |
|
#6 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
Yes - makes sense, doesn't it? If you don't discretize in time, then you don't need an old time, and that never needs to be stored. Simple and elegant.
|
|
March 5, 2015, 18:47 |
|
#7 |
Senior Member
Join Date: Jan 2013
Posts: 372
Rep Power: 14 |
It seems make sense. In one Solver, we will have several time discretizations, like in UEqn, rhoEqn, pEqn, for rho and the relavant quantities. If I follow your line of reasoning, the oldTime() will be store many times?
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM - Validation of Results | Ahmed | OpenFOAM Running, Solving & CFD | 10 | May 13, 2018 19:28 |
Superlinear speedup in OpenFOAM 13 | msrinath80 | OpenFOAM Running, Solving & CFD | 18 | March 3, 2015 06:36 |
OpenFOAM Foundation releases OpenFOAM 2.2.2 | opencfd | OpenFOAM Announcements from ESI-OpenCFD | 0 | October 14, 2013 08:18 |
ESI-OpenCFD Releases OpenFOAM v2.2.0 | opencfd | OpenFOAM Announcements from ESI-OpenCFD | 13 | March 30, 2013 17:52 |
Summer School on Numerical Modelling and OpenFOAM | hjasak | OpenFOAM | 5 | October 12, 2008 14:14 |