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

Is it to possible to change time step DeltaT during a calculation

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 1 Post By dbxmcf
  • 1 Post By dbxmcf
  • 3 Post By philippose
  • 2 Post By parthiv1991

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 13, 2007, 00:44
Default I am using icoFoam to calculat
  #1
Member
 
roy fokker
Join Date: Mar 2009
Posts: 44
Rep Power: 17
dbxmcf is on a distinguished road
I am using icoFoam to calculate a simple fluid, however I want to change the time step dynamically, e.g. first time step is: deltaT[1]=0.001, the next time step is deltaT[2]=0.003, the next is deltaT[3]=0.002, and so on.
i.e.
t0=0
t1=0+0.001=0.001
t2=0.001+0.003=0.004
t3=0.004+0.002=0.006

Maybe it is a wired problem, but in my program it seems that I need such kind of dynamic timestep, is it possible to program it in OpenFOAM? I didn't find any function like runTime.setTimeStep(DeltaT)...the only function I found is adjustDeltaT() but it is protected and after I read through the source, I found it is not doing what I want.

Thanks a lot!
sunshuai likes this.
dbxmcf is offline   Reply With Quote

Old   March 13, 2007, 03:32
Default I use scalar dt=runTime.de
  #2
Senior Member
 
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17
tehache is on a distinguished road
I use

scalar dt=runTime.deltaT()

to get the actual timestep, and

runTime.setDeltaT(dt)

to set it to a new value, works.

Have fun ...

Thomas
tehache is offline   Reply With Quote

Old   November 1, 2007, 18:59
Default Hi. the example above, is e
  #3
Member
 
Ken Darcovich
Join Date: Mar 2009
Location: Ottawa, Canada
Posts: 34
Rep Power: 17
kdarc is on a distinguished road
Hi.

the example above, is exactly what I'm trying to do and when I implement the code as shown above, NOTHING changes.

This makes me think that I also have to have some "include file" statements, or need to have some extra libraries mentioned in the "options" file.

Any advice?

thanks.
kdarc is offline   Reply With Quote

Old   November 1, 2007, 19:48
Default it should work using setDeltaT
  #4
Member
 
roy fokker
Join Date: Mar 2009
Posts: 44
Rep Power: 17
dbxmcf is on a distinguished road
it should work using setDeltaT(dt):

like this:

runTime.setTime(tStart,0);
runTime.setDeltaT(dt);
runTime.setEndTime(runTime.value()+runTime.deltaT( ).value());
Saleh Mey likes this.
dbxmcf is offline   Reply With Quote

Old   November 4, 2007, 15:21
Default Hello, A Good day to you!
  #5
Senior Member
 
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25
philippose will become famous soon enough
Hello,

A Good day to you!

Sorry I could not get into this post a little earlier... I saw the post, but was away, so could not react to it :-)!

Some time back, I had modified the icoFoam solver to include variable time step functionality as a question from another user on this forum.

Unfortunately, I am unable to find that post now... so... here is "icoFoamVarDt"... basically does exactly what you want..... it uses the built in capability in OpenFOAM to limit the Courant Number by adapting the time step size....

Hope this helps....

icoFoamVarDt.tar.gz

In order to activate this, you need to use the "adjustTimeStep yes" option, followed my "maxCo [maximum Co Number you want to limit to]" in the controlDict file.


Philippose
solefire, saba_saeb and manju819 like this.
philippose is offline   Reply With Quote

Old   January 26, 2018, 17:03
Default Adjustable Time-Step
  #6
New Member
 
PLD
Join Date: Jun 2017
Location: Braunschweig, Germany
Posts: 13
Rep Power: 9
parthiv1991 is on a distinguished road
Hello Everyone,

I am trying to implement an adaptive time-stepping scheme based on the error. So for example, a rough code would look like this:
Code:
if  error > tolerance
 {
    //compute new deltaT and set new deltaT;
    runTime.setDeltaT(dt);

    //and Reject this step, and re-compute the same step with a new deltaT = dt;
}
Do anyone of you know how to implement this rejecting a particular step and re-computing the values again in the same step but using a new deltaT ??
I can successfully set the new time-step, but cannot recompute the same step using the new deltaT. I tried runTime--, and also runTime.Times = runTime.times - oldDeltaT; but nothing works.
Even the "adjustTimeStep" is set to "true" in controlDict.

Any help would be appreciated.

Thank you in advance.
cfdlance.com and dats like this.
parthiv1991 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
time step calculation david FLUENT 1 May 7, 2008 02:36
unsteady state calculation with adaptive time step sm FLUENT 0 November 7, 2007 02:26
How to change boundary type at calculation time? Stanislav Kraev FLUENT 0 December 4, 2006 04:33
time step calculation in unsteady solidconduction ps Siemens 0 July 19, 2006 02:01
Time step calculation Shashi Main CFD Forum 1 March 1, 2006 08:27


All times are GMT -4. The time now is 09:12.