Second-oder Crank-Nicolson implicit ddt using the current and previous time-step fields as well as the previous time-step ddt. More...
Public Types | |
typedef ddtScheme< Type >::fluxFieldType | fluxFieldType |
Public Types inherited from ddtScheme< Type > | |
typedef GeometricField< typename flux< Type >::type, fvsPatchField, surfaceMesh > | fluxFieldType |
Additional Inherited Members | |
Static Public Member Functions inherited from ddtScheme< Type > | |
static tmp< ddtScheme< Type > > | New (const fvMesh &mesh, Istream &schemeData) |
Return a pointer to a new ddtScheme created on freestore. More... | |
Protected Member Functions inherited from refCount | |
refCount () | |
Construct null initialising count to 0. More... | |
Protected Attributes inherited from ddtScheme< Type > | |
const fvMesh & | mesh_ |
Second-oder Crank-Nicolson implicit ddt using the current and previous time-step fields as well as the previous time-step ddt.
The Crank-Nicolson scheme is often unstable for complex flows in complex geometries and it is necessary to "off-centre" the scheme to stabilise it while retaining greater temporal accuracy than the first-order Euler-implicit scheme. Off-centering is specified via the mandatory coefficient ocCoeff
in the range [0,1] following the scheme name e.g.
ddtSchemes { default CrankNicolson 0.9; }
or with an optional "ramp" function to transition from the Euler scheme to Crank-Nicolson over a initial period to avoid start-up problems, e.g.
ddtSchemes { default CrankNicolson ocCoeff { type scale; scale linearRamp; duration 0.01; value 0.9; }; }
With a coefficient of 1 the scheme is fully centred and second-order, with a coefficient of 0 the scheme is equivalent to Euler-implicit. A coefficient of 0.9 has been found to be suitable for a range of cases for which higher-order accuracy in time is needed and provides similar accuracy and stability to the backward scheme. However, the backward scheme has been found to be more robust and provides formal second-order accuracy in time.
The advantage of the Crank-Nicolson scheme over backward is that only the new and old-time values are needed, the additional terms relating to the fluxes and sources are evaluated at the mid-point of the time-step which provides the opportunity to limit the fluxes in such a way as to ensure boundedness while maintaining greater accuracy in time compared to the Euler-implicit scheme. This approach is now used with MULES in the interFoam family of solvers. Boundedness cannot be guaranteed with the backward scheme.
Note: The Crank-Nicolson coefficient for the implicit part of the RHS is related to the off-centering coefficient by
cnCoeff = 1.0/(1.0 + ocCoeff);
Definition at line 110 of file CrankNicolsonDdtScheme.H.
typedef ddtScheme<Type>::fluxFieldType fluxFieldType |
Definition at line 283 of file CrankNicolsonDdtScheme.H.
CrankNicolsonDdtScheme | ( | const fvMesh & | mesh | ) |
Construct from mesh.
Definition at line 281 of file CrankNicolsonDdtScheme.C.
References polyMesh::moving(), and fvMesh::V00().
CrankNicolsonDdtScheme | ( | const fvMesh & | mesh, |
Istream & | is | ||
) |
Construct from mesh and Istream.
Definition at line 297 of file CrankNicolsonDdtScheme.C.
References dict, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, CrankNicolsonDdtScheme< Type >::fvcDdt(), token::isNumber(), Function1< Type >::New(), token::number(), CrankNicolsonDdtScheme< Type >::ocCoeff(), and Istream::putBack().
|
delete |
Disallow default bitwise copy construction.
TypeName | ( | "CrankNicolson" | ) |
Runtime type information.
|
inline |
Return mesh reference.
Definition at line 219 of file CrankNicolsonDdtScheme.H.
References ddtScheme< Type >::mesh().
Referenced by CrankNicolsonDdtScheme< Type >::fvcDdt(), CrankNicolsonDdtScheme< Type >::fvcDdtPhiCorr(), CrankNicolsonDdtScheme< Type >::fvcDdtUfCorr(), CrankNicolsonDdtScheme< Type >::fvmDdt(), CrankNicolsonDdtScheme< Type >::meshPhi(), and CrankNicolsonDdtScheme< Type >::ocCoeff().
|
inline |
Return the current off-centreing coefficient.
Definition at line 225 of file CrankNicolsonDdtScheme.H.
References alpha(), CrankNicolsonDdtScheme< Type >::fvcDdt(), CrankNicolsonDdtScheme< Type >::fvmDdt(), CrankNicolsonDdtScheme< Type >::mesh(), psi, and rho.
Referenced by CrankNicolsonDdtScheme< Type >::CrankNicolsonDdtScheme().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 346 of file CrankNicolsonDdtScheme.C.
References dimensioned< Type >::dimensions(), Foam::dimTime, CrankNicolsonDdtScheme< Type >::mesh(), dimensioned< Type >::name(), fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and Foam::Zero.
Referenced by CrankNicolsonDdtScheme< Type >::CrankNicolsonDdtScheme(), CrankNicolsonDdtScheme< Type >::fvcDdt(), and CrankNicolsonDdtScheme< Type >::ocCoeff().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 403 of file CrankNicolsonDdtScheme.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::fv::ff(), CrankNicolsonDdtScheme< Type >::fvcDdt(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and dimensioned< Type >::value().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 479 of file CrankNicolsonDdtScheme.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), dimensioned< Type >::dimensions(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::fv::ff(), CrankNicolsonDdtScheme< Type >::fvcDdt(), CrankNicolsonDdtScheme< Type >::mesh(), dimensioned< Type >::name(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and dimensioned< Type >::value().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 556 of file CrankNicolsonDdtScheme.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::fv::ff(), CrankNicolsonDdtScheme< Type >::fvcDdt(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), GeometricField< Type, PatchField, GeoMesh >::primitiveField(), rho, fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and dimensioned< Type >::value().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 642 of file CrankNicolsonDdtScheme.C.
References alpha(), GeometricField< Type, PatchField, GeoMesh >::boundaryField(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::fv::ff(), CrankNicolsonDdtScheme< Type >::fvmDdt(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), GeometricField< Type, PatchField, GeoMesh >::primitiveField(), rho, fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and dimensioned< Type >::value().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 754 of file CrankNicolsonDdtScheme.C.
References lduMatrix::diag(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimTime, Foam::dimVol, Foam::fv::ff(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), fvMatrix< Type >::source(), fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and dimensioned< Type >::value().
Referenced by CrankNicolsonDdtScheme< Type >::fvcDdt(), CrankNicolsonDdtScheme< Type >::fvmDdt(), and CrankNicolsonDdtScheme< Type >::ocCoeff().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 836 of file CrankNicolsonDdtScheme.C.
References lduMatrix::diag(), dimensioned< Type >::dimensions(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimTime, Foam::dimVol, Foam::fv::ff(), CrankNicolsonDdtScheme< Type >::fvmDdt(), CrankNicolsonDdtScheme< Type >::mesh(), dimensioned< Type >::name(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), fvMatrix< Type >::source(), fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and dimensioned< Type >::value().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 918 of file CrankNicolsonDdtScheme.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), lduMatrix::diag(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimTime, Foam::dimVol, Foam::fv::ff(), CrankNicolsonDdtScheme< Type >::fvmDdt(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), GeometricField< Type, PatchField, GeoMesh >::primitiveField(), fvMatrix< Type >::source(), fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and dimensioned< Type >::value().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1008 of file CrankNicolsonDdtScheme.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), lduMatrix::diag(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimTime, Foam::dimVol, Foam::fv::ff(), CrankNicolsonDdtScheme< Type >::fvcDdtUfCorr(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), GeometricField< Type, PatchField, GeoMesh >::primitiveField(), fvMatrix< Type >::source(), fvMesh::V(), fvMesh::V0(), fvMesh::V00(), and dimensioned< Type >::value().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1119 of file CrankNicolsonDdtScheme.C.
References DimensionedField< Type, GeoMesh >::dimensions(), ddtScheme< Type >::fvcDdtPhiCoeff(), CrankNicolsonDdtScheme< Type >::fvcDdtPhiCorr(), Foam::fvc::interpolate(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), and fvMesh::Sf().
Referenced by CrankNicolsonDdtScheme< Type >::fvcDdtPhiCorr(), and CrankNicolsonDdtScheme< Type >::fvmDdt().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1172 of file CrankNicolsonDdtScheme.C.
References DimensionedField< Type, GeoMesh >::dimensions(), Foam::fvc::dotInterpolate(), ddtScheme< Type >::fvcDdtPhiCoeff(), CrankNicolsonDdtScheme< Type >::fvcDdtUfCorr(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), and fvMesh::Sf().
Referenced by CrankNicolsonDdtScheme< Type >::fvcDdtUfCorr().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1226 of file CrankNicolsonDdtScheme.C.
References Foam::abort(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimVelocity, Foam::FatalError, FatalErrorInFunction, ddtScheme< Type >::fvcDdtPhiCoeff(), CrankNicolsonDdtScheme< Type >::fvcDdtPhiCorr(), Foam::fvc::interpolate(), CrankNicolsonDdtScheme< Type >::mesh(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::null(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), and fvMesh::Sf().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1364 of file CrankNicolsonDdtScheme.C.
References Foam::abort(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimFlux, Foam::dimVelocity, Foam::fvc::dotInterpolate(), Foam::FatalError, FatalErrorInFunction, ddtScheme< Type >::fvcDdtPhiCoeff(), CrankNicolsonDdtScheme< Type >::mesh(), CrankNicolsonDdtScheme< Type >::meshPhi(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::null(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), and fvMesh::Sf().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1490 of file CrankNicolsonDdtScheme.C.
References Foam::dimVolume, CrankNicolsonDdtScheme< Type >::mesh(), Foam::name(), GeometricField< scalar, fvsPatchField, surfaceMesh >::New(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), phi, and fvMesh::phi().
Referenced by CrankNicolsonDdtScheme< Type >::fvcDdtPhiCorr().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1516 of file CrankNicolsonDdtScheme.C.
References Foam::dimVolume, CrankNicolsonDdtScheme< Type >::mesh(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), phi, and fvMesh::phi().
|
delete |
Disallow default bitwise assignment.
CrankNicolsonDdtScheme<Type>::template DDt0Field<GeoField>& ddt0_ | ( | const word & | name, |
const dimensionSet & | dims | ||
) |
Definition at line 107 of file CrankNicolsonDdtScheme.C.
References IOobject::AUTO_WRITE, TimeState::deltaT(), TimeState::deltaT0(), Foam::dimTime, Foam::fv::ff(), CoEulerDdtScheme< Type >::mesh(), IOobject::MUST_READ, Foam::name(), IOobject::NO_READ, ocCoeff, Time::startTime(), Time::startTimeIndex(), regIOobject::store(), fvMesh::time(), timeIndex, TimeState::timeIndex(), timeName, Time::timeName(), dimensioned< Type >::value(), and Foam::Zero.
tmp< surfaceScalarField > fvcDdtUfCorr | ( | const GeometricField< scalar, fvPatchField, volMesh > & | U, |
const GeometricField< scalar, fvsPatchField, surfaceMesh > & | Uf | ||
) |
tmp< surfaceScalarField > fvcDdtPhiCorr | ( | const volScalarField & | U, |
const surfaceScalarField & | phi | ||
) |
tmp< surfaceScalarField > fvcDdtUfCorr | ( | const volScalarField & | rho, |
const volScalarField & | U, | ||
const surfaceScalarField & | Uf | ||
) |
tmp< surfaceScalarField > fvcDdtPhiCorr | ( | const volScalarField & | rho, |
const volScalarField & | U, | ||
const surfaceScalarField & | phi | ||
) |