setRDeltaT.H
Go to the documentation of this file.
1 {
2  volScalarField& rDeltaT = trDeltaT();
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.dimensionedInternalField() = max
60  (
61  1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
63  /((2*maxCo)*mesh.V()*rho.dimensionedInternalField())
64  );
65 
67  {
68  // Further limit the reciprocal time-step
69  // in the vicinity of the interface
70 
72 
73  rDeltaT.dimensionedInternalField() = max
74  (
75  rDeltaT.dimensionedInternalField(),
76  pos(alpha1Bar.dimensionedInternalField() - alphaSpreadMin)
77  *pos(alphaSpreadMax - alpha1Bar.dimensionedInternalField())
78  *fvc::surfaceSum(mag(phi))().dimensionedInternalField()
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.internalField())
88  << ", " << gMax(1/rDeltaT.internalField()) << 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.internalField())
115  << ", " << gMax(1/rDeltaT.internalField()) << 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.0) - rDeltaTDampingCoeff)*rDeltaT0
130  );
131 
132  Info<< "Damped flow time scale min/max = "
133  << gMin(1/rDeltaT.internalField())
134  << ", " << gMax(1/rDeltaT.internalField()) << endl;
135  }
136 }
dimensioned< scalar > mag(const dimensioned< Type > &)
scalar maxCo(readScalar(pimpleDict.lookup("maxCo")))
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
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
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
messageStream Info
dynamicFvMesh & mesh
rhoPhi
Definition: rhoEqn.H:10
void sweep(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2)
Definition: fvcSmooth.C:222
const dictionary & pimple
scalar alphaSpreadDiff(pimpleDict.lookupOrDefault< scalar >("alphaSpreadDiff", 0.2))
scalar rDeltaTSmoothingCoeff(pimpleDict.lookupOrDefault< scalar >("rDeltaTSmoothingCoeff", 0.1))
label nAlphaSpreadIter(pimpleDict.lookupOrDefault< label >("nAlphaSpreadIter", 1))
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
label nAlphaSweepIter(pimpleDict.lookupOrDefault< label >("nAlphaSweepIter", 5))
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
volScalarField rDeltaT0("rDeltaT0", rDeltaT)
scalar alphaSpreadMax(pimpleDict.lookupOrDefault< scalar >("alphaSpreadMax", 0.99))
volScalarField & alpha1
Definition: createFields.H:15
Type gMin(const FieldField< Field, Type > &f)
surfaceScalarField & phi
rDeltaT dimensionedInternalField()
tmp< volScalarField > trDeltaT
Definition: createRDeltaT.H:3
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
Definition: fvcAverage.C:46
dimensionedScalar pos(const dimensionedScalar &ds)
scalar maxAlphaCo(pimpleDict.lookupOrDefault< scalar >("maxAlphaCo", 0.2))
scalar rDeltaTDampingCoeff(pimpleDict.lookupOrDefault< scalar >("rDeltaTDampingCoeff", 1))
scalar maxDeltaT(pimpleDict.lookupOrDefault< scalar >("maxDeltaT", GREAT))
scalar alphaSpreadMin(pimpleDict.lookupOrDefault< scalar >("alphaSpreadMin", 0.01))
Type gMax(const FieldField< Field, Type > &f)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void smooth(volScalarField &field, const scalar coeff)
Definition: fvcSmooth.C:35