1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 Info<< "Time scales min/max:" << endl;
30 // Cache old time scale field
31 tmp<volScalarField> trDeltaT
47 const volScalarField& rDeltaT0 = trDeltaT();
56 mag(phi)*mesh.deltaCoeffs()/(maxCo*mesh.magSf())
60 rDeltaT.max(1.0/maxDeltaT);
63 << gMin(1/rDeltaT.internalField()) << ", "
64 << gMax(1/rDeltaT.internalField()) << endl;
68 // Temperature source time scale
69 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78 + parcels.hsTrans()/(mesh.V()*runTime.deltaT())
85 tau = alphaTemp*thermo.Cp()*T/(tau + ROOTVSMALL);
87 Info<< " Temperature = " << min(maxDeltaT, gMin(tau)) << ", "
88 << min(maxDeltaT, gMax(tau)) << endl;
90 rDeltaT.internalField() = max(rDeltaT.internalField(), 1/tau);
94 // Limit rate of change of time scale
95 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96 // - reduce as much as required for flow, but limit source contributions
97 const dimensionedScalar deltaTRamp("deltaTRamp", dimless, 1/(1 + 0.2));
98 rDeltaT = max(rDeltaT, rDeltaT0*deltaTRamp);
101 // Limit the largest time scale
102 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103 rDeltaT.max(1/maxDeltaT);
106 // Spatially smooth the time scale field
107 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108 fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
110 Info<< " Overall = " << min(1/rDeltaT).value()
111 << ", " << max(1/rDeltaT).value() << nl << endl;
115 // ************************************************************************* //