Loading...
Searching...
No Matches
setRDeltaT.H
1{
2 volScalarField& rDeltaT = trDeltaT.ref();
3
4 const dictionary& pimpleDict = pimple.dict();
5
6 scalar maxCo
7 (
8 pimpleDict.getOrDefault<scalar>("maxCo", 0.8)
9 );
10
11 scalar rDeltaTSmoothingCoeff
12 (
13 pimpleDict.getOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
14 );
15
16 scalar rDeltaTDampingCoeff
17 (
18 pimpleDict.getOrDefault<scalar>("rDeltaTDampingCoeff", 1.0)
19 );
20
21 scalar maxDeltaT
22 (
23 pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT)
24 );
25
26 volScalarField rDeltaT0("rDeltaT0", rDeltaT);
27
28 // Set the reciprocal time-step from the local Courant number
29 rDeltaT.ref() = max
30 (
31 1 / dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
32 fvc::surfaceSum(mag(phi))()()
33 / ((2 * maxCo) * mesh.V() * rho())
34 );
35
36 if (pimple.transonic())
37 {
38 surfaceScalarField phid
39 (
40 "phid",
41 fvc::interpolate(psi)*fvc::flux(U)
42 );
43 rDeltaT.ref() = max
44 (
45 rDeltaT(),
46 fvc::surfaceSum(mag(phid))()()
47 / ((2 * maxCo) * mesh.V() * psi())
48 );
49 }
50
51 // Update tho boundary values of the reciprocal time-step
52 rDeltaT.correctBoundaryConditions();
53
54 Info << "Flow time scale min/max = "
55 << gMin(1 / rDeltaT.primitiveField())
56 << ", " << gMax(1 / rDeltaT.primitiveField()) << endl;
57
58 if (rDeltaTSmoothingCoeff < 1.0)
59 {
60 fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
61 }
62
63 Info << "Smoothed flow time scale min/max = "
64 << gMin(1 / rDeltaT.primitiveField())
65 << ", " << gMax(1 / rDeltaT.primitiveField()) << endl;
66
67 // Limit rate of change of time scale
68 // - reduce as much as required
69 // - only increase at a fraction of old time scale
70 if
71 (
72 rDeltaTDampingCoeff < 1.0
73 && runTime.timeIndex() > runTime.startTimeIndex() + 1
74 )
75 {
76 rDeltaT =
77 rDeltaT0
78 * max(rDeltaT / rDeltaT0, scalar(1) - rDeltaTDampingCoeff);
79 Info << "Damped flow time scale min/max = "
80 << gMin(1 / rDeltaT.primitiveField())
81 << ", " << gMax(1 / rDeltaT.primitiveField()) << endl;
82 }
83}
T max(Eigen::SparseMatrix< T > &mat, label &ind_row, label &ind_col)
Find the maximum of a sparse Matrix (Useful for DEIM).