diff --git a/applications/solvers/incompressible/pimpleFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/createFields.H index 089cc0871a..4aecb61b06 100644 --- a/applications/solvers/incompressible/pimpleFoam/createFields.H +++ b/applications/solvers/incompressible/pimpleFoam/createFields.H @@ -1,3 +1,5 @@ +#include "createRDeltaT.H" + Info<< "Reading field p\n" << endl; volScalarField p ( diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index b970945062..34e3e0bc82 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -39,6 +39,8 @@ Description #include "pimpleControl.H" #include "CorrectPhi.H" #include "fvOptions.H" +#include "localEulerDdtScheme.H" +#include "fvcSmooth.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,11 +55,15 @@ int main(int argc, char *argv[]) #include "createDyMControls.H" #include "createFields.H" #include "createUfIfPresent.H" - #include "CourantNo.H" - #include "setInitialDeltaT.H" turbulence->validate(); + if (!LTS) + { + #include "CourantNo.H" + #include "setInitialDeltaT.H" + } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; @@ -65,8 +71,16 @@ int main(int argc, char *argv[]) while (runTime.run()) { #include "readDyMControls.H" - #include "CourantNo.H" - #include "setDeltaT.H" + + if (LTS) + { + #include "setRDeltaT.H" + } + else + { + #include "CourantNo.H" + #include "setDeltaT.H" + } runTime++; diff --git a/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H b/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H new file mode 100644 index 0000000000..19b1d65979 --- /dev/null +++ b/applications/solvers/incompressible/pimpleFoam/setRDeltaT.H @@ -0,0 +1,69 @@ +{ + volScalarField& rDeltaT = trDeltaT.ref(); + + const dictionary& pimpleDict = pimple.dict(); + + scalar maxCo + ( + pimpleDict.lookupOrDefault("maxCo", 0.8) + ); + + scalar rDeltaTSmoothingCoeff + ( + pimpleDict.lookupOrDefault("rDeltaTSmoothingCoeff", 0.02) + ); + + scalar rDeltaTDampingCoeff + ( + pimpleDict.lookupOrDefault("rDeltaTDampingCoeff", 1.0) + ); + + scalar maxDeltaT + ( + pimpleDict.lookupOrDefault("maxDeltaT", great) + ); + + volScalarField rDeltaT0("rDeltaT0", rDeltaT); + + // Set the reciprocal time-step from the local Courant number + rDeltaT.ref() = max + ( + 1/dimensionedScalar(dimTime, maxDeltaT), + fvc::surfaceSum(mag(phi))()() + /((2*maxCo)*mesh.V()) + ); + + // Update tho boundary values of the reciprocal time-step + rDeltaT.correctBoundaryConditions(); + + Info<< "Flow time scale min/max = " + << gMin(1/rDeltaT.primitiveField()) + << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + + if (rDeltaTSmoothingCoeff < 1.0) + { + fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); + } + + Info<< "Smoothed flow time scale min/max = " + << gMin(1/rDeltaT.primitiveField()) + << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + + // Limit rate of change of time scale + // - reduce as much as required + // - only increase at a fraction of old time scale + if + ( + rDeltaTDampingCoeff < 1.0 + && runTime.timeIndex() > runTime.startTimeIndex() + 1 + ) + { + rDeltaT = + rDeltaT0 + *max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff); + + Info<< "Damped flow time scale min/max = " + << gMin(1/rDeltaT.primitiveField()) + << ", " << gMax(1/rDeltaT.primitiveField()) << endl; + } +} diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/U b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/U new file mode 100644 index 0000000000..ff8284793c --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/U @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value uniform (10 0 0); + } + + outlet + { + type zeroGradient; + } + + upperWall + { + type noSlip; + } + + lowerWall + { + type noSlip; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/epsilon b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/epsilon new file mode 100644 index 0000000000..7a4c4fd5d3 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/epsilon @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 14.855; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 14.855; + } + outlet + { + type zeroGradient; + } + upperWall + { + type epsilonWallFunction; + value uniform 14.855; + } + lowerWall + { + type epsilonWallFunction; + value uniform 14.855; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/k b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/k new file mode 100644 index 0000000000..5161f12ee4 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/k @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.375; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 0.375; + } + outlet + { + type zeroGradient; + } + upperWall + { + type kqRWallFunction; + value uniform 0.375; + } + lowerWall + { + type kqRWallFunction; + value uniform 0.375; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/nuTilda b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/nuTilda new file mode 100644 index 0000000000..c1985e0939 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/nuTilda @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type fixedValue; + value uniform 0; + } + + outlet + { + type zeroGradient; + } + + upperWall + { + type zeroGradient; + } + + lowerWall + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/nut b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/nut new file mode 100644 index 0000000000..c281640a8d --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/nut @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } + upperWall + { + type nutkWallFunction; + value uniform 0; + } + lowerWall + { + type nutkWallFunction; + value uniform 0; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/p b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/p new file mode 100644 index 0000000000..0521b7991c --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/0/p @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet + { + type fixedValue; + value uniform 0; + } + + upperWall + { + type zeroGradient; + } + + lowerWall + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/constant/transportProperties b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/constant/transportProperties new file mode 100644 index 0000000000..ff270d42ff --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/constant/transportProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu [0 2 -1 0 0 0 0] 1e-05; + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/constant/turbulenceProperties b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/constant/turbulenceProperties new file mode 100644 index 0000000000..2099b3cb0f --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/constant/turbulenceProperties @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kEpsilon; + + turbulence on; + + printCoeffs on; +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/blockMeshDict b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/blockMeshDict new file mode 100644 index 0000000000..f133c1d268 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/blockMeshDict @@ -0,0 +1,152 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + (-20.6 0 -0.5) + (-20.6 25.4 -0.5) + (0 -25.4 -0.5) + (0 0 -0.5) + (0 25.4 -0.5) + (206 -25.4 -0.5) + (206 0 -0.5) + (206 25.4 -0.5) + (290 -16.6 -0.5) + (290 0 -0.5) + (290 16.6 -0.5) + + (-20.6 0 0.5) + (-20.6 25.4 0.5) + (0 -25.4 0.5) + (0 0 0.5) + (0 25.4 0.5) + (206 -25.4 0.5) + (206 0 0.5) + (206 25.4 0.5) + (290 -16.6 0.5) + (290 0 0.5) + (290 16.6 0.5) +); + +negY +( + (2 4 1) + (1 3 0.3) +); + +posY +( + (1 4 2) + (2 3 4) + (2 4 0.25) +); + +posYR +( + (2 1 1) + (1 1 0.25) +); + + +blocks +( + hex (0 3 4 1 11 14 15 12) + (18 30 1) + simpleGrading (0.5 $posY 1) + + hex (2 5 6 3 13 16 17 14) + (180 27 1) + edgeGrading (4 4 4 4 $negY 1 1 $negY 1 1 1 1) + + hex (3 6 7 4 14 17 18 15) + (180 30 1) + edgeGrading (4 4 4 4 $posY $posYR $posYR $posY 1 1 1 1) + + hex (5 8 9 6 16 19 20 17) + (25 27 1) + simpleGrading (2.5 1 1) + + hex (6 9 10 7 17 20 21 18) + (25 30 1) + simpleGrading (2.5 $posYR 1) +); + +edges +( +); + +boundary +( + inlet + { + type patch; + faces + ( + (0 1 12 11) + ); + } + outlet + { + type patch; + faces + ( + (8 9 20 19) + (9 10 21 20) + ); + } + upperWall + { + type wall; + faces + ( + (1 4 15 12) + (4 7 18 15) + (7 10 21 18) + ); + } + lowerWall + { + type wall; + faces + ( + (0 3 14 11) + (3 2 13 14) + (2 5 16 13) + (5 8 19 16) + ); + } + frontAndBack + { + type empty; + faces + ( + (0 3 4 1) + (2 5 6 3) + (3 6 7 4) + (5 8 9 6) + (6 9 10 7) + (11 14 15 12) + (13 16 17 14) + (14 17 18 15) + (16 19 20 17) + (17 20 21 18) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/controlDict b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/controlDict new file mode 100644 index 0000000000..9d1cd4d8eb --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/controlDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application pimpleFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1000; + +deltaT 1; + +writeControl runTime; + +writeInterval 10; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/fvSchemes b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/fvSchemes new file mode 100644 index 0000000000..94995a3ad3 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/fvSchemes @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default localEuler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + + div(phi,U) Gauss linearUpwind grad(U); + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,R) Gauss upwind; + div(R) Gauss linear; + div(phi,nuTilda) Gauss upwind; + + div((nuEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/fvSolution b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/fvSolution new file mode 100644 index 0000000000..9616fa6d9d --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/RAS/pitzDailyLTS/system/fvSolution @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "p.*" + { + solver GAMG; + smoother DIC; + + tolerance 1e-7; + relTol 0.01; + } + + "(U|k|epsilon).*" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-6; + relTol 0.1; + } +} + +PIMPLE +{ + nNonOrthogonalCorrectors 0; + nCorrectors 2; + + maxCo 1; + rDeltaTSmoothingCoeff 0.1; + maxDeltaT 1; +} + + +// ************************************************************************* //