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