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

Problems with adjust time step control

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 31, 2016, 12:06
Default Problems with adjust time step control
  #1
New Member
 
Join Date: Apr 2015
Posts: 5
Rep Power: 11
jzheng is on a distinguished road
Hi all,

I am using OF3.0 to recompile a solver that it was written under OF231.

The solver is good in OF231, but it encountered a problem when compiling with OF3.0 since the system always tells me a error like this:
---------------------------------
/opt/openfoam30/src/finiteVolume/lnInclude/readTimeControls.H: In function ‘int main(int, char**)’:

/opt/openfoam30/src/finiteVolume/lnInclude/readTimeControls.H:32:1: error: ‘adjustTimeStep’ was not declared in this scope

/opt/openfoam30/src/finiteVolume/lnInclude/readTimeControls.H:35:1: error: ‘maxCo’ was not declared in this scope

/opt/openfoam30/src/finiteVolume/lnInclude/readTimeControls.H:38:1: error: ‘maxDeltaT’ was not declared in this scope
----------------------------------

The header files in my solver now look like this:
.
.
.
int main(int argc, char *argv[])
{

#include "setRootCase.H"
#include "createTime.H"
#include "createMeshes.H"

#include "readSurfaceFlowProperties.H"

#include "createSurfaceFields.H"
#include "createSubsurfaceFields.H"

#include "readCoupledSolutionControls.H"

#include "createInterpolator.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.run())
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
.
.
.

My controlDict has the following lines attached:
============================
adjustTimeStep yes;
maxCo 0.5;
maxDeltaT 1E-3;

And my problem is how can I correct this missing declaration?
jzheng is offline   Reply With Quote

Old   September 1, 2016, 03:23
Default
  #2
Member
 
Arsalan
Join Date: Jul 2014
Posts: 74
Rep Power: 11
arsalan.dryi is on a distinguished road
Hi jzheng

Modify your solver as follows:

Code:
Info<< "\nStarting time loop\n" << endl;

while (runTime.run())	
{	
const bool adjustTimeStep =
    runTime.controlDict().lookupOrDefault("adjustTimeStep", false);

scalar maxCo =
    runTime.controlDict().lookupOrDefault<scalar>("maxCo", 1.0);

scalar maxDeltaT =
    runTime.controlDict().lookupOrDefault<scalar>("maxDeltaT", GREAT);	
#include "CourantNo.H"
#include "setDeltaT.H"
Regards,
Arsalan.
arsalan.dryi is offline   Reply With Quote

Old   September 1, 2016, 18:22
Default
  #3
New Member
 
Join Date: Apr 2015
Posts: 5
Rep Power: 11
jzheng is on a distinguished road
Hi Arsalan

Thanks for the hints, and it works. May I ask how this could happen? I noticed the difference of the "readTimeControls" head file between OF231 and OF30 is that OF30 canceled all of the data type of these three parameters: adjustTimeStep, maxCo, maxDeltaT.

Thanks
jzheng is offline   Reply With Quote

Old   November 2, 2020, 12:47
Default
  #4
New Member
 
Jaime
Join Date: Oct 2020
Posts: 1
Rep Power: 0
Jaime Castañeda is on a distinguished road
Hi all,

I am using (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. I am getting errors when compiled in OpenFOAM.

The error messages are attached:
error: ‘adjustTimeStep’ was not declared in this scope
error: ‘maxCo’ was not declared in this scope
error: ‘maxDeltaT’ was not declared in this scope


The header files in the solver are from the RichardsFoam equation.

int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"

#include "readTimeControls.H"

#include "readPicardControls.H"
...
...
...
...
Info<< "\nStarting time loop\n" << endl;

// starting of the time loop.
while (runTime.loop())
{

// time step control operations.
#include "readTimeControls.H"
#include "setDeltaT.H"

Info<< "Time = " << runTime.timeName() << nl << endl;

...
...
...
...
My controlDict has the following lines attached:
============================
application porousUnsaturatedFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 86400;

deltaT 300;

writeControl adjustableRunTime;

writeInterval 7200;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

adjustTimeStep yes;

maxDeltaT 3600;

functions
(
probes1
{
type probes; // Type of functionObject
// Where to load it from (if not already in solver)
functionObjectLibs ("libsampling.so");
probeLocations // Locations to be probed. runTime modifiable!
(
(0.5 0.5 1.)
);
// Fields to be probed. runTime modifiable!
fields
(
U
);
}
);


libs ( "libOpenFOAM.so" );
libs ("libuserBCs.so");

and fv solution

Picard
{
nIterPicard 10;
nMaxCycle 10;
stabilisationThreshold 10;
precPicard 1e-4;
tFact 1.3;
}


please can someone explain to me what's going on? Thank you very much
Jaime Castañeda is offline   Reply With Quote

Old   November 2, 2020, 23:38
Default
  #5
New Member
 
Sumit Peh
Join Date: Oct 2018
Location: Beijing
Posts: 20
Rep Power: 7
Jamessmp23 is on a distinguished road
Your time step "DeltaT" is really large. In my field that large is an unreasonable step size.
Jamessmp23 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
time step continuity problem in VAWT simulation lpz_michele OpenFOAM Running, Solving & CFD 5 February 22, 2018 19:50
Stuck in a Rut- interDyMFoam! xoitx OpenFOAM Running, Solving & CFD 14 March 25, 2016 07:09
Help for the small implementation in turbulence model shipman OpenFOAM Programming & Development 25 March 19, 2014 10:08
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 09:34


All times are GMT -4. The time now is 04:30.