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

How to access previous time

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 13, 2014, 03:52
Default How to access previous time
  #1
Member
 
Join Date: Nov 2009
Posts: 65
Rep Power: 16
waku2005 is on a distinguished road
Dear All,

I'd like to know how to declare the previous time and access the previous time folder including 0 within my original library.
I know the current time and the current/previous time step can be obtained as follows, but don't for the previous time step "tp".

----------------------------------------------
const Time& time;

// current Time and timeStep
scalar t = time.value();
scalar dt = time.deltaTValue();

// old Time
scalar tp = ?????
scalar dtp = time.deltaT0Value();

// time step number (i.e., time index)
Info << "Time Step Index: " << time.timeIndex() << endl;
---------------------------------------------

Please let me know any way to the "tp"

Sincerely,
waku2005
waku2005 is offline   Reply With Quote

Old   December 16, 2014, 08:40
Default
  #2
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
This would also be interesting to me. My simulations are very dynamic and often become instable, which forces me to reduce the courant number temporarily to avoid unphysical results. Since these results are sometimes detectable (for example by extreme changes in min/max temperature), it would be nice if we could step back one time step, decrease the courant number and calculate again starting from the previous step.
chriss85 is offline   Reply With Quote

Old   December 16, 2014, 18:39
Default
  #3
Member
 
Join Date: Nov 2009
Posts: 65
Rep Power: 16
waku2005 is on a distinguished road
My objective is to calculate moment and force vectors dynamically from field values at the previous time step, within my original solidMeshMotionFunctions developing for using in such a pimpleDyMFoam solver.

In the pimpleDyMSolver(may also be in the other DyM solvers), after a time stepping, mesh.update() was called before new p and U were calculated. If the mesh motion was prescribed using omega(rad/s) defined in the dynamicMeshDict, there's no problem.

But for my simulation, mesh motion (i.e., eulerAngles of mesh rotation) should be numerically defined by using the moment and forces those previous U and p. That's why I should access the previous time step values of the field values (NOT the previous output data!).

Any comments and suggestions were highly appreciated !

Thanks in advance,
waku2005
waku2005 is offline   Reply With Quote

Old   December 16, 2014, 19:06
Default
  #4
Member
 
Join Date: Nov 2009
Posts: 65
Rep Power: 16
waku2005 is on a distinguished road
Wmmm..., I'd like to know at first,
1) U.oldTime() is automatically stored ?
2) U.oldTime() is the U of the previous time step, not the previous outputted U in a time folder ?

Sorry for my primitive questions.
waku2005 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
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 04:13
Multiple floating objects CKH OpenFOAM Running, Solving & CFD 14 February 20, 2019 09:08
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 13:40
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 00:01
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03


All times are GMT -4. The time now is 07:20.