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... | |
Static Public Attributes inherited from ddtSchemeBase | |
static bool | experimentalDdtCorr |
Flag to use experimental ddtCorr from org version Default is off for backwards compatibility. More... | |
Protected Member Functions inherited from ddtScheme< Type > | |
ddtScheme (const ddtScheme &)=delete | |
No copy construct. More... | |
void | operator= (const ddtScheme &)=delete |
No copy assignment. More... | |
Protected Attributes inherited from ddtScheme< Type > | |
const fvMesh & | mesh_ |
scalar | ddtPhiCoeff_ |
Input for fvcDdtPhiCoeff. More... | |
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 stabilize 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.
cnCoeff = 1.0/(1.0 + ocCoeff);
Definition at line 112 of file CrankNicolsonDdtScheme.H.
typedef ddtScheme<Type>::fluxFieldType fluxFieldType |
Definition at line 335 of file CrankNicolsonDdtScheme.H.
CrankNicolsonDdtScheme | ( | const fvMesh & | mesh | ) |
Construct from mesh.
Definition at line 279 of file CrankNicolsonDdtScheme.C.
References CrankNicolsonDdtScheme< Type >::mesh(), polyMesh::moving(), and fvMesh::V00().
CrankNicolsonDdtScheme | ( | const fvMesh & | mesh, |
Istream & | is | ||
) |
Construct from mesh and Istream.
Definition at line 295 of file CrankNicolsonDdtScheme.C.
References dict, Foam::exit(), Foam::FatalIOError, FatalIOErrorInFunction, token::isNumber(), mesh, token::number(), ocCoeff, and Istream::putBack().
TypeName | ( | "CrankNicolson" | ) |
Runtime type information.
|
inline |
Return mesh reference.
Definition at line 269 of file CrankNicolsonDdtScheme.H.
References ddtScheme< Type >::mesh().
Referenced by CrankNicolsonDdtScheme< Type >::CrankNicolsonDdtScheme(), and CrankNicolsonDdtScheme< Type >::ocCoeff().
|
inline |
Return the current off-centreing coefficient.
Definition at line 277 of file CrankNicolsonDdtScheme.H.
References CrankNicolsonDdtScheme< Type >::mesh().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 341 of file CrankNicolsonDdtScheme.C.
References dimensioned< Type >::dimensions(), Foam::dimTime, Foam::stringOps::evaluate(), mesh, dimensioned< Type >::name(), and Foam::Zero.
|
virtual |
Implements ddtScheme< Type >.
Definition at line 403 of file CrankNicolsonDdtScheme.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::stringOps::evaluate(), Foam::fv::ff(), mesh, IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), and tmp< T >::ref().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 497 of file CrankNicolsonDdtScheme.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::stringOps::evaluate(), Foam::fv::ff(), mesh, IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), GeometricField< Type, PatchField, GeoMesh >::primitiveField(), tmp< T >::ref(), and rho.
|
virtual |
Implements ddtScheme< Type >.
Definition at line 594 of file CrankNicolsonDdtScheme.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryField(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::stringOps::evaluate(), Foam::fv::ff(), mesh, IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), GeometricField< Type, PatchField, GeoMesh >::primitiveField(), tmp< T >::ref(), and rho.
|
virtual |
Implements ddtScheme< Type >.
Definition at line 701 of file CrankNicolsonDdtScheme.C.
References Foam::constant::atomic::alpha, GeometricField< Type, PatchField, GeoMesh >::boundaryField(), dimensioned< Type >::dimensions(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::stringOps::evaluate(), Foam::fv::ff(), mesh, dimensioned< Type >::name(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), GeometricField< Type, PatchField, GeoMesh >::primitiveField(), tmp< T >::ref(), and rho.
|
virtual |
Implements ddtScheme< Type >.
Definition at line 838 of file CrankNicolsonDdtScheme.C.
References lduMatrix::diag(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimTime, Foam::dimVol, Foam::stringOps::evaluate(), Foam::fv::ff(), mesh, IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), and fvMatrix< Type >::source().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 921 of file CrankNicolsonDdtScheme.C.
References lduMatrix::diag(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimTime, Foam::dimVol, Foam::stringOps::evaluate(), Foam::fv::ff(), mesh, IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), rho, and fvMatrix< Type >::source().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1003 of file CrankNicolsonDdtScheme.C.
References lduMatrix::diag(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimTime, Foam::dimVol, Foam::stringOps::evaluate(), Foam::fv::ff(), mesh, IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), rho, and fvMatrix< Type >::source().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1093 of file CrankNicolsonDdtScheme.C.
References Foam::constant::atomic::alpha, lduMatrix::diag(), dimensioned< Type >::dimensions(), DimensionedField< Type, GeoMesh >::dimensions(), Foam::dimTime, Foam::dimVol, Foam::stringOps::evaluate(), Foam::fv::ff(), mesh, dimensioned< Type >::name(), IOobject::name(), GeometricField< Type, PatchField, GeoMesh >::oldTime(), rho, and fvMatrix< Type >::source().
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1204 of file CrankNicolsonDdtScheme.C.
References Foam::stringOps::evaluate(), Foam::fvc::interpolate(), mesh, U, and Uf.
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1265 of file CrankNicolsonDdtScheme.C.
References Foam::fvc::dotInterpolate(), Foam::stringOps::evaluate(), mesh, phi, and U.
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1328 of file CrankNicolsonDdtScheme.C.
References Foam::abort(), Foam::fvc::ddtCorr(), Foam::dimVelocity, Foam::stringOps::evaluate(), Foam::FatalError, FatalErrorInFunction, Foam::fvc::interpolate(), mesh, rho, U, and Uf.
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1485 of file CrankNicolsonDdtScheme.C.
References Foam::abort(), Foam::fvc::ddtCorr(), Foam::dimArea, Foam::dimVelocity, Foam::fvc::dotInterpolate(), Foam::stringOps::evaluate(), Foam::FatalError, FatalErrorInFunction, mesh, phi, rho, and U.
|
virtual |
Implements ddtScheme< Type >.
Definition at line 1630 of file CrankNicolsonDdtScheme.C.
References Foam::dimVolume, Foam::stringOps::evaluate(), mesh, Foam::name(), IOobjectOption::NO_READ, IOobjectOption::NO_REGISTER, IOobjectOption::NO_WRITE, phi, and timeName.
CrankNicolsonDdtScheme<Type>::template DDt0Field<GeoField>& ddt0_ | ( | const word & | name, |
const dimensionSet & | dims | ||
) |
Definition at line 103 of file CrankNicolsonDdtScheme.C.
References IOobjectOption::AUTO_WRITE, Foam::dimTime, mesh, IOobjectOption::MUST_READ, Foam::name(), IOobjectOption::NO_READ, runTime, regIOobject::store(), timeName, 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 | ||
) |