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.8)
9  );
10 
12  (
13  pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
14  );
15 
16  scalar rDeltaTDampingCoeff
17  (
18  pimpleDict.lookupOrDefault<scalar>("rDeltaTDampingCoeff", 1.0)
19  );
20 
21  scalar maxDeltaT
22  (
23  pimpleDict.lookupOrDefault<scalar>("maxDeltaT", GREAT)
24  );
25 
26  volScalarField rDeltaT0("rDeltaT0", rDeltaT);
27 
28  // Set the reciprocal time-step from the local Courant number
29  rDeltaT.dimensionedInternalField() = max
30  (
31  1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
33  /((2*maxCo)*mesh.V()*rho.dimensionedInternalField())
34  );
35 
36  if (pimple.transonic())
37  {
39  (
40  "phid",
42  );
43 
44  rDeltaT.dimensionedInternalField() = max
45  (
46  rDeltaT.dimensionedInternalField(),
48  /((2*maxCo)*mesh.V()*psi.dimensionedInternalField())
49  );
50  }
51 
52  // Update tho boundary values of the reciprocal time-step
53  rDeltaT.correctBoundaryConditions();
54 
55  Info<< "Flow time scale min/max = "
56  << gMin(1/rDeltaT.internalField())
57  << ", " << gMax(1/rDeltaT.internalField()) << endl;
58 
59  if (rDeltaTSmoothingCoeff < 1.0)
60  {
62  }
63 
64  Info<< "Smoothed flow time scale min/max = "
65  << gMin(1/rDeltaT.internalField())
66  << ", " << gMax(1/rDeltaT.internalField()) << endl;
67 
68  // Limit rate of change of time scale
69  // - reduce as much as required
70  // - only increase at a fraction of old time scale
71  if
72  (
74  && runTime.timeIndex() > runTime.startTimeIndex() + 1
75  )
76  {
77  rDeltaT =
78  rDeltaT0
79  *max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff);
80 
81  Info<< "Damped flow time scale min/max = "
82  << gMin(1/rDeltaT.internalField())
83  << ", " << gMax(1/rDeltaT.internalField()) << endl;
84  }
85 }
Foam::fvc::surfaceSum
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcSurfaceIntegrate.C:138
phid
surfaceScalarField phid("phid", fvc::interpolate(psi) *((mesh.Sf() &fvc::interpolate(HbyA))+rhorAUf *fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)))
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
dimensionedInternalField
rDeltaT dimensionedInternalField()
Foam::MULES::interpolate
tmp< surfaceScalarField > interpolate(const RhoType &rho)
Definition: IMULESTemplates.C:40
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
U
U
Definition: pEqn.H:46
rDeltaTSmoothingCoeff
scalar rDeltaTSmoothingCoeff(pimpleDict.lookupOrDefault< scalar >("rDeltaTSmoothingCoeff", 0.1))
pimpleDict
const dictionary & pimpleDict
Definition: setRDeltaT.H:29
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::Info
messageStream Info
maxCo
scalar maxCo(readScalar(pimpleDict.lookup("maxCo")))
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
maxDeltaT
scalar maxDeltaT(pimpleDict.lookupOrDefault< scalar >("maxDeltaT", GREAT))
rho
rho
Definition: pEqn.H:3
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
rDeltaTDampingCoeff
scalar rDeltaTDampingCoeff(pimpleDict.lookupOrDefault< scalar >("rDeltaTDampingCoeff", 1))
psi
const volScalarField & psi
Definition: setRegionFluidFields.H:13
Foam::surfaceScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Definition: surfaceFieldsFwd.H:52
trDeltaT
tmp< volScalarField > trDeltaT
Definition: createRDeltaT.H:3
pimple
const dictionary & pimple
Definition: readFluidMultiRegionPIMPLEControls.H:1
rDeltaT0
volScalarField rDeltaT0("rDeltaT0", rDeltaT)
Foam::gMin
Type gMin(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:563
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:562
Foam::fvc::smooth
void smooth(volScalarField &field, const scalar coeff)
Definition: fvcSmooth.C:35