|
[Sponsors] |
Modifying sonicFoam to run with variable timestep - strange results |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 31, 2013, 08:19 |
Modifying sonicFoam to run with variable timestep - strange results
|
#1 |
New Member
Aaron
Join Date: Mar 2013
Posts: 10
Rep Power: 13 |
I have modified the sonicFoam solver (version 2.1.1) to run a variable timestep and with maximum Courant number. The reason I want to have a variable timestep sonicFoam solver is to perform a grid dependency study, and doing so with a static timestep was very frustrating.
The modified solver works for some grid resolutions and not for others. I don't know why. The test case, and some (incorrect) pressure plots are attached. At the start of the simulation I set MaxCo = 0.2 in my controlDict file, run own_sonicFoam, and everything appears to be proceeding okay. A typical output near the start of the simulation is: Code:
Courant Number mean: 0.0629867 max: 0.200099 deltaT = 2.48178e-05 TIME = 0.127543 Then at a certain point the timestep drops rapidly and there is a huge discrepancy between the Courant number mean and max: Code:
Courant Number mean: 8.67688e-05 max: 0.2 deltaT = 1.53002e-09 TIME = 0.199746794 One of the more confusing things about this was that for one test case (refer blockMeshDict file) I found that an odd number of cells in the vertical direction caused problems, but an even number gave a good solution. The changes I made to the sonicFoam solver are: Code:
#include "fvCFD.H" #include "basicPsiThermo.H" #include "turbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nSTARTING TIME LOOP\n" << endl; while (runTime.loop()) //runTime.run() ? { #include "readPISOControls.H" #include "compressibleCourantNo.H" #include "readTimeControls.H" #include "setDeltaT.H" runTime++; Info<< "TIME = " << runTime.timeName() << nl << endl; //#include "readPISOControls.H" //#include "compressibleCourantNo.H" #include "rhoEqn.H" #include "UEqn.H" #include "eEqn.H" // --- PISO loop for (int corr=0; corr<nCorr; corr++) { #include "pEqn.H" } turbulence->correct(); rho = thermo.rho(); // thermodynamics call. runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info<< "End\n" << endl; return 0; } Last edited by dalaron; August 31, 2013 at 09:48. Reason: wrong .C file initially |
|
September 2, 2013, 08:21 |
|
#2 |
New Member
Aaron
Join Date: Mar 2013
Posts: 10
Rep Power: 13 |
A semi-progress update. Increasing the Courant number from 0.2 to 0.5 solves this problem and gives me good results.
As far as I understand, the Courant number only affects the stability of the solver. So shouldn't a higher Courant number be more likely to cause problems? What have I done wrong here that a lower Courant number is doing this instead? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Variable BC in time and space for transient run | Porry | CFX | 2 | February 21, 2012 10:38 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 21:02 |
intermediate results during a transient run | Michael Skoblin | CFX | 1 | September 25, 2006 15:00 |
Error when changing timestep in transient run | Tony | CFX | 4 | December 8, 2004 15:13 |
Replace periodic by inlet-outlet pair | lego | CFX | 3 | November 5, 2002 21:09 |