diff --git a/applications/solvers/combustion/XiFoam/PDRFoam/setDeltaT.H b/applications/solvers/combustion/XiFoam/PDRFoam/setDeltaT.H
index 74fcde3b6e..d523d0d0db 100644
--- a/applications/solvers/combustion/XiFoam/PDRFoam/setDeltaT.H
+++ b/applications/solvers/combustion/XiFoam/PDRFoam/setDeltaT.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -33,17 +33,14 @@ Description
if (adjustTimeStep)
{
- scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + small);
- scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
+ scalar maxDeltaT = maxCo*runTime.deltaTValue()/(CoNum + StCoNum + small);
- runTime.setDeltaT
- (
- min
- (
- deltaTFact*runTime.deltaTValue(),
- maxDeltaT
- )
- );
+ maxDeltaT = min(maxDeltaT, fvModels.maxDeltaT());
+
+ const scalar deltaT =
+ min(min(maxDeltaT, 1.0 + 0.1*maxDeltaT), 1.2*runTime.deltaTValue());
+
+ runTime.setDeltaT(min(deltaT, maxDeltaT));
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}
diff --git a/applications/solvers/compressible/rhoCentralFoam/setDeltaT.H b/applications/solvers/compressible/rhoCentralFoam/setDeltaT.H
new file mode 100644
index 0000000000..7f7ac838af
--- /dev/null
+++ b/applications/solvers/compressible/rhoCentralFoam/setDeltaT.H
@@ -0,0 +1,46 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Global
+ setDeltaT
+
+Description
+ Reset the timestep to maintain a constant maximum courant Number.
+ Reduction of time-step is immediate, but increase is damped to avoid
+ unstable oscillations.
+
+\*---------------------------------------------------------------------------*/
+
+if (adjustTimeStep)
+{
+ scalar maxDeltaT = maxCo*runTime.deltaTValue()/(CoNum + small);
+
+ const scalar deltaT =
+ min(min(maxDeltaT, 1.0 + 0.1*maxDeltaT), 1.2*runTime.deltaTValue());
+
+ runTime.setDeltaT(min(deltaT, maxDeltaT));
+
+ Info<< "deltaT = " << runTime.deltaTValue() << endl;
+}
+
+// ************************************************************************* //
diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/setDeltaT.H b/applications/solvers/multiphase/twoLiquidMixingFoam/setDeltaT.H
new file mode 100644
index 0000000000..51ec1d29a8
--- /dev/null
+++ b/applications/solvers/multiphase/twoLiquidMixingFoam/setDeltaT.H
@@ -0,0 +1,48 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Global
+ setDeltaT
+
+Description
+ Reset the timestep to maintain a constant maximum courant Number.
+ Reduction of time-step is immediate, but increase is damped to avoid
+ unstable oscillations.
+
+\*---------------------------------------------------------------------------*/
+
+if (adjustTimeStep)
+{
+ scalar maxDeltaT =
+ min(maxCo/(CoNum + small), maxAlphaCo/(alphaCoNum + small))
+ *runTime.deltaTValue();
+
+ const scalar deltaT =
+ min(min(maxDeltaT, 1.0 + 0.1*maxDeltaT), 1.2*runTime.deltaTValue());
+
+ runTime.setDeltaT(min(deltaT, maxDeltaT));
+
+ Info<< "deltaT = " << runTime.deltaTValue() << endl;
+}
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/cfdTools/general/fvModels/fvModel.C b/src/finiteVolume/cfdTools/general/fvModels/fvModel.C
index 6721c904b3..467dfda744 100644
--- a/src/finiteVolume/cfdTools/general/fvModels/fvModel.C
+++ b/src/finiteVolume/cfdTools/general/fvModels/fvModel.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -146,6 +146,12 @@ bool Foam::fvModel::addsSupToField(const word& fieldName) const
}
+Foam::scalar Foam::fvModel::maxDeltaT() const
+{
+ return great;
+}
+
+
FOR_ALL_FIELD_TYPES(IMPLEMENT_FV_MODEL_ADD_SUP, fvModel);
diff --git a/src/finiteVolume/cfdTools/general/fvModels/fvModel.H b/src/finiteVolume/cfdTools/general/fvModels/fvModel.H
index f09aaf573e..951416ee68 100644
--- a/src/finiteVolume/cfdTools/general/fvModels/fvModel.H
+++ b/src/finiteVolume/cfdTools/general/fvModels/fvModel.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -258,6 +258,9 @@ public:
// field's transport equation
virtual bool addsSupToField(const word& fieldName) const;
+ //- Return the maximum time-step for stable operation
+ virtual scalar maxDeltaT() const;
+
// Sources
diff --git a/src/finiteVolume/cfdTools/general/fvModels/fvModels.C b/src/finiteVolume/cfdTools/general/fvModels/fvModels.C
index 9f4dc15f80..1643456332 100644
--- a/src/finiteVolume/cfdTools/general/fvModels/fvModels.C
+++ b/src/finiteVolume/cfdTools/general/fvModels/fvModels.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -237,6 +237,21 @@ bool Foam::fvModels::addsSupToField(const word& fieldName) const
}
+Foam::scalar Foam::fvModels::maxDeltaT() const
+{
+ const PtrListDictionary& modelList(*this);
+
+ scalar maxDeltaT = great;
+
+ forAll(modelList, i)
+ {
+ maxDeltaT = min(maxDeltaT, modelList[i].maxDeltaT());
+ }
+
+ return maxDeltaT;
+}
+
+
void Foam::fvModels::preUpdateMesh()
{
PtrListDictionary& modelList(*this);
diff --git a/src/finiteVolume/cfdTools/general/fvModels/fvModels.H b/src/finiteVolume/cfdTools/general/fvModels/fvModels.H
index 1fa0b36498..d70a89148a 100644
--- a/src/finiteVolume/cfdTools/general/fvModels/fvModels.H
+++ b/src/finiteVolume/cfdTools/general/fvModels/fvModels.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -130,6 +130,9 @@ public:
// field's transport equation
virtual bool addsSupToField(const word& fieldName) const;
+ //- Return the maximum time-step for stable operation
+ virtual scalar maxDeltaT() const;
+
// Sources
diff --git a/src/finiteVolume/cfdTools/general/include/setDeltaT.H b/src/finiteVolume/cfdTools/general/include/setDeltaT.H
index 29487bdcdc..df3961401f 100644
--- a/src/finiteVolume/cfdTools/general/include/setDeltaT.H
+++ b/src/finiteVolume/cfdTools/general/include/setDeltaT.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -33,17 +33,14 @@ Description
if (adjustTimeStep)
{
- scalar maxDeltaTFact = maxCo/(CoNum + small);
- scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
+ scalar maxDeltaT = maxCo*runTime.deltaTValue()/(CoNum + small);
- runTime.setDeltaT
- (
- min
- (
- deltaTFact*runTime.deltaTValue(),
- maxDeltaT
- )
- );
+ maxDeltaT = min(maxDeltaT, fvModels.maxDeltaT());
+
+ const scalar deltaT =
+ min(min(maxDeltaT, 1.0 + 0.1*maxDeltaT), 1.2*runTime.deltaTValue());
+
+ runTime.setDeltaT(min(deltaT, maxDeltaT));
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}
diff --git a/src/twoPhaseModels/twoPhaseMixture/VoF/setDeltaT.H b/src/twoPhaseModels/twoPhaseMixture/VoF/setDeltaT.H
index 42d93dda7d..1b01659054 100644
--- a/src/twoPhaseModels/twoPhaseMixture/VoF/setDeltaT.H
+++ b/src/twoPhaseModels/twoPhaseMixture/VoF/setDeltaT.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -33,19 +33,16 @@ Description
if (adjustTimeStep)
{
- scalar maxDeltaTFact =
- min(maxCo/(CoNum + small), maxAlphaCo/(alphaCoNum + small));
+ scalar maxDeltaT =
+ min(maxCo/(CoNum + small), maxAlphaCo/(alphaCoNum + small))
+ *runTime.deltaTValue();
- scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
+ maxDeltaT = min(maxDeltaT, fvModels.maxDeltaT());
- runTime.setDeltaT
- (
- min
- (
- deltaTFact*runTime.deltaTValue(),
- maxDeltaT
- )
- );
+ const scalar deltaT =
+ min(min(maxDeltaT, 1.0 + 0.1*maxDeltaT), 1.2*runTime.deltaTValue());
+
+ runTime.setDeltaT(min(deltaT, maxDeltaT));
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}