setRDeltaT.H
Go to the documentation of this file.
1 {
2  volScalarField& rDeltaT = trDeltaT.ref();
3 
4  const dictionary& pimpleDict = pimple.dict();
5 
6  const scalar maxCo
7  (
8  pimpleDict.lookupOrDefault<scalar>("maxCo", 0.9)
9  );
10 
11  const scalar maxAlphaCo
12  (
13  pimpleDict.lookupOrDefault<scalar>("maxAlphaCo", 0.2)
14  );
15 
16  const scalar rDeltaTSmoothingCoeff
17  (
18  pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
19  );
20 
22  (
23  pimpleDict.lookupOrDefault<label>("nAlphaSpreadIter", 1)
24  );
25 
26  const scalar alphaSpreadDiff
27  (
28  pimpleDict.lookupOrDefault<scalar>("alphaSpreadDiff", 0.2)
29  );
30 
31  const scalar alphaSpreadMax
32  (
33  pimpleDict.lookupOrDefault<scalar>("alphaSpreadMax", 0.99)
34  );
35 
36  const scalar alphaSpreadMin
37  (
38  pimpleDict.lookupOrDefault<scalar>("alphaSpreadMin", 0.01)
39  );
40 
42  (
43  pimpleDict.lookupOrDefault<label>("nAlphaSweepIter", 5)
44  );
45 
46  const scalar maxDeltaT
47  (
48  pimpleDict.lookupOrDefault<scalar>("maxDeltaT", great)
49  );
50 
51  const scalar minDeltaT
52  (
53  pimpleDict.lookupOrDefault<scalar>("minDeltaT", small)
54  );
55 
56  const volScalarField rDeltaT0("rDeltaT0", rDeltaT);
57 
58  // Set the reciprocal time-step from the local Courant number
59  // and maximum and minimum time-steps
60  rDeltaT.ref() = min
61  (
63  max
64  (
66  fvc::surfaceSum(mag(phi))()()
67  /((2*maxCo)*mesh.V())
68  )
69  );
70 
72  {
73  // Further limit the reciprocal time-step
74  // in the vicinity of the interface
75 
77 
78  rDeltaT.ref() = max
79  (
80  rDeltaT(),
81  pos0(alpha1Bar() - alphaSpreadMin)
82  *pos0(alphaSpreadMax - alpha1Bar())
83  *fvc::surfaceSum(mag(phi))()()
84  /((2*maxAlphaCo)*mesh.V())
85  );
86  }
87 
88  // Update the boundary values of the reciprocal time-step
89  rDeltaT.correctBoundaryConditions();
90 
91  Info<< "Flow time scale min/max = "
92  << gMin(1/rDeltaT.primitiveField())
93  << ", " << gMax(1/rDeltaT.primitiveField()) << endl;
94 
95  if (rDeltaTSmoothingCoeff < 1.0)
96  {
98  }
99 
100  if (nAlphaSpreadIter > 0)
101  {
103  (
104  rDeltaT,
105  alpha1,
110  );
111  }
112 
113  if (nAlphaSweepIter > 0)
114  {
116  }
117 
118  Info<< "Smoothed flow time scale min/max = "
119  << gMin(1/rDeltaT.primitiveField())
120  << ", " << gMax(1/rDeltaT.primitiveField()) << endl;
121 
122  // Limit rate of change of time scale
123  // - reduce as much as required
124  // - only increase at a fraction of old time scale
125  if
126  (
127  pimpleDict.found("rDeltaTDampingCoeff")
128  && runTime.timeIndex() > runTime.startTimeIndex() + 1
129  )
130  {
131  // Damping coefficient (1-0)
132  const scalar rDeltaTDampingCoeff
133  (
134  pimpleDict.lookup<scalar>("rDeltaTDampingCoeff")
135  );
136 
137  rDeltaT = max
138  (
139  rDeltaT,
140  (scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
141  );
142 
143  Info<< "Damped flow time scale min/max = "
144  << gMin(1/rDeltaT.primitiveField())
145  << ", " << gMax(1/rDeltaT.primitiveField()) << endl;
146  }
147 }
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const scalar minDeltaT(pimpleDict.lookupOrDefault< scalar >("minDeltaT", small))
pimpleNoLoopControl & pimple
void spread(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2, const scalar alphaMax=0.99, const scalar alphaMin=0.01)
Definition: fvcSmooth.C:134
Type gMin(const FieldField< Field, Type > &f)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
volScalarField & alpha1(mixture.alpha1())
const label nAlphaSweepIter(pimpleDict.lookupOrDefault< label >("nAlphaSweepIter", 5))
fvMesh & mesh
void smooth(volScalarField &field, const scalar coeff)
Definition: fvcSmooth.C:35
const volScalarField rDeltaT0("rDeltaT0", rDeltaT)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
const dimensionSet dimTime
void sweep(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2)
Definition: fvcSmooth.C:240
const scalar maxAlphaCo(pimpleDict.lookupOrDefault< scalar >("maxAlphaCo", 0.2))
const label nAlphaSpreadIter(pimpleDict.lookupOrDefault< label >("nAlphaSpreadIter", 1))
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
phi
Definition: correctPhi.H:3
const scalar alphaSpreadDiff(pimpleDict.lookupOrDefault< scalar >("alphaSpreadDiff", 0.2))
const scalar maxCo(pimpleDict.lookupOrDefault< scalar >("maxCo", 0.9))
const scalar alphaSpreadMax(pimpleDict.lookupOrDefault< scalar >("alphaSpreadMax", 0.99))
dimensionedScalar pos0(const dimensionedScalar &ds)
Type gMax(const FieldField< Field, Type > &f)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const scalar rDeltaTSmoothingCoeff(pimpleDict.lookupOrDefault< scalar >("rDeltaTSmoothingCoeff", 0.1))
messageStream Info
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
Definition: fvcAverage.C:46
dimensioned< scalar > mag(const dimensioned< Type > &)
const scalar rDeltaTDampingCoeff(pimpleDict.lookupOrDefault< scalar >("rDeltaTDampingCoeff", 1.0))
const scalar alphaSpreadMin(pimpleDict.lookupOrDefault< scalar >("alphaSpreadMin", 0.01))
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< volScalarField > trDeltaT
Definition: createRDeltaT.H:3
const scalar maxDeltaT(pimpleDict.lookupOrDefault< scalar >("maxDeltaT", great))