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

Varying time step

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Display Modes
Old   January 19, 2014, 18:00
Default Varying time step
  #1
New Member
 
erik gustafsson
Join Date: Oct 2013
Posts: 19
Rep Power: 4
guserik is on a distinguished road
Is it possible to set a fixed varying time step in openfoam? Let say i want

deltaT = 0.0001 if t>=0 && t<=1
deltaT = 0.001 if t>1 && t<=2
deltaT = 0.01 if t>2 && t<=3

If there is i would be really happy if someone have an example of this. At the moment I'm not satisfied with adjustableTimeStep.

Thanks
guserik is offline   Reply With Quote

Old   January 19, 2014, 22:22
Default
  #2
Member
 
Eric Robertson
Join Date: Jul 2012
Posts: 95
Rep Power: 6
msuaeronautics is on a distinguished road
This is certainly possible if you modify the source code of the particular solver you want to use. Would require a set of if statements.
msuaeronautics is offline   Reply With Quote

Old   January 20, 2014, 02:54
Default
  #3
New Member
 
Josh
Join Date: Jun 2013
Posts: 14
Rep Power: 5
joshm is on a distinguished road
A less-than-elegant solution might be just to run a bash script which replaces the controlDict file and runs the solver again.
joshm is offline   Reply With Quote

Old   January 20, 2014, 04:55
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,419
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

You can create 3 different controlDicts with required deltaT parameter and then use function objects to update control dictionary during the time. Put something like:

Code:
functions
{
    fileUpdate1
    {
        type            timeActivatedFileUpdate;
        functionObjectLibs ("libutilityFunctionObjects.so");
        outputControl   timeStep;
        outputInterval  1;
        fileToUpdate    "$FOAM_CASE/system/controlDict";
        timeVsFile
        (
            (-1    "$FOAM_CASE/system/controlDict_1")
            (1    "$FOAM_CASE/system/controlDict_2")
            (2    "$FOAM_CASE/system/controlDict_3")
        );
    }
}
in controlDicts you've created.

So from the beginning of the simulation it will use controlDict_1 where you put deltaT=0.0001, from 1 to 2 s it will use controlDict_2 where you put deltatT=0.001 etc.
msuaeronautics likes this.
alexeym is offline   Reply With Quote

Old   January 20, 2014, 04:58
Default
  #5
New Member
 
erik gustafsson
Join Date: Oct 2013
Posts: 19
Rep Power: 4
guserik is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

You can create 3 different controlDicts with required deltaT parameter and then use function objects to update control dictionary during the time. Put something like:

Code:
functions
{
    fileUpdate1
    {
        type            timeActivatedFileUpdate;
        functionObjectLibs ("libutilityFunctionObjects.so");
        outputControl   timeStep;
        outputInterval  1;
        fileToUpdate    "$FOAM_CASE/system/controlDict";
        timeVsFile
        (
            (-1    "$FOAM_CASE/system/controlDict_1")
            (1    "$FOAM_CASE/system/controlDict_2")
            (2    "$FOAM_CASE/system/controlDict_3")
        );
    }
}
in controlDicts you've created.

So from the beginning of the simulation it will use controlDict_1 where you put deltaT=0.0001, from 1 to 2 s it will use controlDict_2 where you put deltatT=0.001 etc.
Thanks for the suggestion, i will try this

(-1 "$FOAM_CASE/system/controlDict_1")
(1 "$FOAM_CASE/system/controlDict_2")
(2 "$FOAM_CASE/system/controlDict_3")

-1 / 1 / 2 is those number related to time?
guserik is offline   Reply With Quote

Old   January 20, 2014, 07:37
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,419
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
Quote:
Originally Posted by guserik View Post
(-1 "$FOAM_CASE/system/controlDict_1")
(1 "$FOAM_CASE/system/controlDict_2")
(2 "$FOAM_CASE/system/controlDict_3")

-1 / 1 / 2 is those number related to time?
Yes. Actually it is time in seconds when file update will occure.
alexeym is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 11:08
Time step size and max iterations per time step pUl| FLUENT 31 August 21, 2015 04:46
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 07:37
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 9 January 3, 2012 09:06
Full pipe 3D using icoFoam cyberbrain OpenFOAM 4 March 16, 2011 10:20


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