mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
src/OpenFOAM/algorithms/subCycle: corrected handling of oldTime field to support outer iteration
Note: currently only the oldTime field is handled so only Euler ddt is supported with outer iteration
This commit is contained in:
@ -40,13 +40,11 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class subCycle Declaration
|
Class subCycleField Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class GeometricField>
|
template<class GeometricField>
|
||||||
class subCycle
|
class subCycleField
|
||||||
:
|
|
||||||
public subCycleTime
|
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -57,6 +55,41 @@ class subCycle
|
|||||||
GeometricField gf0_;
|
GeometricField gf0_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct field and number of sub-cycles
|
||||||
|
subCycleField(GeometricField& gf)
|
||||||
|
:
|
||||||
|
gf_(gf),
|
||||||
|
gf0_(gf.oldTime())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~subCycleField()
|
||||||
|
{
|
||||||
|
// Correct the time index of the field to correspond to the global time
|
||||||
|
gf_.timeIndex() = gf_.time().timeIndex();
|
||||||
|
|
||||||
|
// Reset the old-time field value
|
||||||
|
gf_.oldTime() = gf0_;
|
||||||
|
gf_.oldTime().timeIndex() = gf0_.timeIndex();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class subCycle Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class GeometricField>
|
||||||
|
class subCycle
|
||||||
|
:
|
||||||
|
public subCycleField<GeometricField>,
|
||||||
|
public subCycleTime
|
||||||
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -73,9 +106,9 @@ public:
|
|||||||
//- Construct field and number of sub-cycles
|
//- Construct field and number of sub-cycles
|
||||||
subCycle(GeometricField& gf, const label nSubCycles)
|
subCycle(GeometricField& gf, const label nSubCycles)
|
||||||
:
|
:
|
||||||
subCycleTime(const_cast<Time&>(gf.time()), nSubCycles),
|
|
||||||
gf_(gf),
|
subCycleField<GeometricField>(gf),
|
||||||
gf0_(gf.oldTime())
|
subCycleTime(const_cast<Time&>(gf.time()), nSubCycles)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -84,13 +117,6 @@ public:
|
|||||||
{
|
{
|
||||||
// End the subCycleTime, which restores the time state
|
// End the subCycleTime, which restores the time state
|
||||||
endSubCycle();
|
endSubCycle();
|
||||||
|
|
||||||
// Correct the time index of the field to correspond to the global time
|
|
||||||
gf_.timeIndex() = gf_.time().timeIndex();
|
|
||||||
|
|
||||||
// Reset the old-time field value
|
|
||||||
gf_.oldTime() = gf0_;
|
|
||||||
gf_.oldTime().timeIndex() = gf_.time().timeIndex();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user