|
[Sponsors] |
August 31, 2016, 12:06 |
Problems with adjust time step control
|
#1 |
New Member
Join Date: Apr 2015
Posts: 5
Rep Power: 11 |
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? |
|
September 1, 2016, 03:23 |
|
#2 |
Member
Arsalan
Join Date: Jul 2014
Posts: 74
Rep Power: 11 |
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" Arsalan. |
|
September 1, 2016, 18:22 |
|
#3 |
New Member
Join Date: Apr 2015
Posts: 5
Rep Power: 11 |
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 |
|
November 2, 2020, 12:47 |
|
#4 |
New Member
Jaime
Join Date: Oct 2020
Posts: 1
Rep Power: 0 |
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 |
|
November 2, 2020, 23:38 |
|
#5 |
New Member
Sumit Peh
Join Date: Oct 2018
Location: Beijing
Posts: 20
Rep Power: 7 |
Your time step "DeltaT" is really large. In my field that large is an unreasonable step size.
|
|
|
|
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 |