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

Varying time step

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 6 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread 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: 13
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: 15
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: 19
Rep Power: 13
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,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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.
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: 13
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,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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


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 size and max iterations per time step pUl| FLUENT 31 October 23, 2020 23:50
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 14:40
Extrusion with OpenFoam problem No. Iterations 0 Lord Kelvin OpenFOAM Running, Solving & CFD 8 March 28, 2016 12:08
calculation stops after few time steps sivakumar OpenFOAM Running, Solving & CFD 7 March 17, 2013 07:37
Full pipe 3D using icoFoam cyberbrain OpenFOAM 4 March 16, 2011 10:20


All times are GMT -4. The time now is 05:23.