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

Varying time step increment in OpenFoam controlDict file

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2024, 16:39
Default Varying time step increment in OpenFoam controlDict file
  #1
New Member
 
Hongbin Wang
Join Date: Feb 2020
Posts: 20
Rep Power: 6
Origami is on a distinguished road
I am modelling wind in built-in urban areas. The domain is (-1500 -1200 -4.65946) (2000 1200 500) in meters. The distance between the inlet and the outlet is 3500m. I would like the first 1000 time steps the time increment is 2 and later the increment is 1. How do I achieve this in controlDict file?
Many thanks.
Origami is offline   Reply With Quote

Old   April 3, 2024, 04:08
Default
  #2
Member
 
Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 59
Rep Power: 3
unilord is on a distinguished road
Quote:
Originally Posted by Origami View Post
I am modelling wind in built-in urban areas. The domain is (-1500 -1200 -4.65946) (2000 1200 500) in meters. The distance between the inlet and the outlet is 3500m. I would like the first 1000 time steps the time increment is 2 and later the increment is 1. How do I achieve this in controlDict file?
Many thanks.
Hey,

I am not sure if there is an automated way to do this. Nevertheless, you can set the runTimeModifiable option to true in the controlDict, and when you see the analysis reaching 1000 time steps change it to 2 seconds. It will proceed just like nothing has happened.

Hope this helps,
Pedro Gouveia
unilord is offline   Reply With Quote

Old   April 4, 2024, 18:32
Default
  #3
New Member
 
Hongbin Wang
Join Date: Feb 2020
Posts: 20
Rep Power: 6
Origami is on a distinguished road
worked out. the controlDict below works. This is a revision from the tutorial file (esi 2212)
combustion/XiEngineFoam/kivaTest/system/controlDict

// Make sure all utilities know specialised models
libs (atmosphericModels);

application simpleFoam;

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 5000;

deltaT 1;

writeControl timeStep;

writeInterval 1000;

purgeWrite 2;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;


functions
{
timeStep
{
name setDeltaT;
type coded;
libs (utilityFunctionObjects);

code
#{
#};

codeExecute
#{
const Time& runTime = mesh().time();
if (runTime.timeToUserTime(runTime.value()) <100)
{
const_cast<Time&>(runTime).setDeltaT
(
runTime.userTimeToTime(2)
);
}

else

{
const_cast<Time&>(runTime).setDeltaT
(
runTime.userTimeToTime(1)
);
}


#};
}

// #include "momentum"
}
Origami 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
Postprocess: sampleDict works but creates no output folder shock77 OpenFOAM Post-Processing 14 November 15, 2021 08:27
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 18:13
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 17:34
Trouble compiling utilities using source-built OpenFOAM Artur OpenFOAM Programming & Development 14 October 29, 2013 10:59
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58


All times are GMT -4. The time now is 14:59.