setRDeltaT.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29{
30 volScalarField& rDeltaT = trDeltaT.ref();
31
32 const dictionary& pimpleDict = pimple.dict();
33
34 // Maximum flow Courant number
35 scalar maxCo(pimpleDict.get<scalar>("maxCo"));
36
37 // Maximum time scale
38 scalar maxDeltaT(pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT));
39
40 // Smoothing parameter (0-1) when smoothing iterations > 0
42 (
43 pimpleDict.getOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
44 );
45
46 // Damping coefficient (1-0)
48 (
49 pimpleDict.getOrDefault<scalar>("rDeltaTDampingCoeff", 0.2)
50 );
51
52 // Maximum change in cell temperature per iteration
53 // (relative to previous value)
54 scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05));
55
56
57 Info<< "Time scales min/max:" << endl;
58
59 // Cache old reciprocal time scale field
60 volScalarField rDeltaT0("rDeltaT0", rDeltaT);
61
62 // Flow time scale
63 {
64 rDeltaT.ref() =
65 (
66 fvc::surfaceSum(mag(phi))()()
67 /((2*maxCo)*mesh.V()*rho())
68 );
69
70 // Limit the largest time scale
71 rDeltaT.max(1/maxDeltaT);
72
73 Info<< " Flow = "
74 << gMin(1/rDeltaT.primitiveField()) << ", "
75 << gMax(1/rDeltaT.primitiveField()) << endl;
76 }
77
78 // Reaction source time scale
79 {
80 volScalarField::Internal rDeltaTT
81 (
82 mag
83 (
84 parcels.hsTrans()/(mesh.V()*runTime.deltaT())
85 + Qdot
86 )
87 /(
89 *rho()
90 *thermo.Cp()()()
91 *T()
92 )
93 );
94
95 Info<< " Temperature = "
96 << gMin(1/(rDeltaTT.field() + VSMALL)) << ", "
97 << gMax(1/(rDeltaTT.field() + VSMALL)) << endl;
98
99 rDeltaT.ref() = max
100 (
101 rDeltaT(),
102 rDeltaTT
103 );
104 }
105
106 // Update the boundary values of the reciprocal time-step
107 rDeltaT.correctBoundaryConditions();
108
109 // Spatially smooth the time scale field
110 if (rDeltaTSmoothingCoeff < 1.0)
111 {
112 fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
113 }
114
115 // Limit rate of change of time scale
116 // - reduce as much as required
117 // - only increase at a fraction of old time scale
118 if
119 (
121 && runTime.timeIndex() > runTime.startTimeIndex() + 1
122 )
123 {
124 rDeltaT = max
125 (
126 rDeltaT,
127 (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
128 );
129 }
130
131 Info<< " Overall = "
132 << gMin(1/rDeltaT.primitiveField())
133 << ", " << gMax(1/rDeltaT.primitiveField()) << endl;
134}
135
136
137// ************************************************************************* //
Y[inertIndex] max(0.0)
surfaceScalarField & phi
pimpleControl & pimple
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
const volScalarField & T
scalar rDeltaTDampingCoeff(pimpleDict.getOrDefault< scalar >("rDeltaTDampingCoeff", 1.0))
const dictionary & pimpleDict
Definition: setRDeltaT.H:32
scalar rDeltaTSmoothingCoeff(pimpleDict.getOrDefault< scalar >("rDeltaTSmoothingCoeff", 0.1))
scalar alphaTemp(pimpleDict.getOrDefault< scalar >("alphaTemp", 0.05))
volScalarField rDeltaT0("rDeltaT0", rDeltaT)
dynamicFvMesh & mesh
engineTime & runTime
tmp< volScalarField > trDeltaT
Definition: createRDeltaT.H:3
scalar maxCo
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
Type gMin(const FieldField< Field, Type > &f)
Type gMax(const FieldField< Field, Type > &f)
scalar Qdot
Definition: solveChemistry.H:2