mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
MULES limitation removed: sub-cycling time now supported on morphing meshes
Support for cell-volume interpolation during time sub-cycling now provided and used in the MULES VoF solver to allow sub-cycling on morphing meshes.
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -625,21 +625,25 @@ void Foam::Time::setDeltaT(const scalar deltaT)
|
|||||||
Foam::TimeState Foam::Time::subCycle(const label nSubCycles)
|
Foam::TimeState Foam::Time::subCycle(const label nSubCycles)
|
||||||
{
|
{
|
||||||
subCycling_ = true;
|
subCycling_ = true;
|
||||||
|
prevTimeState_.set(new TimeState(*this));
|
||||||
|
|
||||||
TimeState ts = *this;
|
|
||||||
setTime(*this - deltaT(), (timeIndex() - 1)*nSubCycles);
|
setTime(*this - deltaT(), (timeIndex() - 1)*nSubCycles);
|
||||||
deltaT_ /= nSubCycles;
|
deltaT_ /= nSubCycles;
|
||||||
deltaT0_ /= nSubCycles;
|
deltaT0_ /= nSubCycles;
|
||||||
deltaTSave_ = deltaT0_;
|
deltaTSave_ = deltaT0_;
|
||||||
|
|
||||||
return ts;
|
return prevTimeState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::Time::endSubCycle(const TimeState& ts)
|
void Foam::Time::endSubCycle()
|
||||||
{
|
{
|
||||||
|
if (subCycling_)
|
||||||
|
{
|
||||||
subCycling_ = false;
|
subCycling_ = false;
|
||||||
TimeState::operator=(ts);
|
TimeState::operator=(prevTimeState());
|
||||||
|
prevTimeState_.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -127,6 +127,9 @@ protected:
|
|||||||
//- Is the time currently being sub-cycled?
|
//- Is the time currently being sub-cycled?
|
||||||
bool subCycling_;
|
bool subCycling_;
|
||||||
|
|
||||||
|
//- If time is being sub-cycled this is the previous TimeState
|
||||||
|
autoPtr<TimeState> prevTimeState_;
|
||||||
|
|
||||||
//- Time directory name format
|
//- Time directory name format
|
||||||
static fmtflags format_;
|
static fmtflags format_;
|
||||||
|
|
||||||
@ -347,6 +350,18 @@ public:
|
|||||||
return functionObjects_;
|
return functionObjects_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return true if time currently being sub-cycled, otherwise false
|
||||||
|
bool subCycling() const
|
||||||
|
{
|
||||||
|
return subCycling_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return previous TimeState if time is being sub-cycled
|
||||||
|
const TimeState& prevTimeState() const
|
||||||
|
{
|
||||||
|
return prevTimeState_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
@ -427,8 +442,8 @@ public:
|
|||||||
//- Set time to sub-cycle for the given number of steps
|
//- Set time to sub-cycle for the given number of steps
|
||||||
virtual TimeState subCycle(const label nSubCycles);
|
virtual TimeState subCycle(const label nSubCycles);
|
||||||
|
|
||||||
//- Reset time after sub-cycling back to given TimeState
|
//- Reset time after sub-cycling back to previous TimeState
|
||||||
virtual void endSubCycle(const TimeState&);
|
virtual void endSubCycle();
|
||||||
|
|
||||||
//- Return non-const access to the list of function objects
|
//- Return non-const access to the list of function objects
|
||||||
functionObjectList& functionObjects()
|
functionObjectList& functionObjects()
|
||||||
|
|||||||
@ -32,9 +32,10 @@ Foam::subCycleTime::subCycleTime(Time& t, const label nSubCycles)
|
|||||||
:
|
:
|
||||||
time_(t),
|
time_(t),
|
||||||
nSubCycles_(nSubCycles),
|
nSubCycles_(nSubCycles),
|
||||||
subCycleIndex_(0),
|
subCycleIndex_(0)
|
||||||
initialTimeState_(time_.subCycle(nSubCycles_))
|
{
|
||||||
{}
|
time_.subCycle(nSubCycles_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -55,7 +56,7 @@ bool Foam::subCycleTime::end() const
|
|||||||
|
|
||||||
void Foam::subCycleTime::endSubCycle()
|
void Foam::subCycleTime::endSubCycle()
|
||||||
{
|
{
|
||||||
time_.endSubCycle(initialTimeState_);
|
time_.endSubCycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,6 @@ class subCycleTime
|
|||||||
|
|
||||||
label nSubCycles_;
|
label nSubCycles_;
|
||||||
label subCycleIndex_;
|
label subCycleIndex_;
|
||||||
TimeState initialTimeState_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -34,6 +34,7 @@ License
|
|||||||
#include "fvcSurfaceIntegrate.H"
|
#include "fvcSurfaceIntegrate.H"
|
||||||
#include "slicedSurfaceFields.H"
|
#include "slicedSurfaceFields.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
|
|
||||||
#include "fvm.H"
|
#include "fvm.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -107,7 +108,7 @@ void Foam::MULES::explicitSolve
|
|||||||
{
|
{
|
||||||
psiIf =
|
psiIf =
|
||||||
(
|
(
|
||||||
mesh.V0()*rho.oldTime()*psi0/(deltaT*mesh.V())
|
mesh.Vsc0()*rho.oldTime()*psi0/(deltaT*mesh.Vsc())
|
||||||
+ Su.field()
|
+ Su.field()
|
||||||
- psiIf
|
- psiIf
|
||||||
)/(rho/deltaT - Sp.field());
|
)/(rho/deltaT - Sp.field());
|
||||||
@ -325,7 +326,8 @@ void Foam::MULES::limiter
|
|||||||
|
|
||||||
const unallocLabelList& owner = mesh.owner();
|
const unallocLabelList& owner = mesh.owner();
|
||||||
const unallocLabelList& neighb = mesh.neighbour();
|
const unallocLabelList& neighb = mesh.neighbour();
|
||||||
const scalarField& V = mesh.V();
|
tmp<volScalarField::DimensionedInternalField> tVsc = mesh.Vsc();
|
||||||
|
const scalarField& V = tVsc();
|
||||||
const scalar deltaT = mesh.time().deltaTValue();
|
const scalar deltaT = mesh.time().deltaTValue();
|
||||||
|
|
||||||
const scalarField& phiBDIf = phiBD;
|
const scalarField& phiBDIf = phiBD;
|
||||||
@ -452,14 +454,16 @@ void Foam::MULES::limiter
|
|||||||
|
|
||||||
if (mesh.moving())
|
if (mesh.moving())
|
||||||
{
|
{
|
||||||
|
tmp<volScalarField::DimensionedInternalField> V0 = mesh.Vsc0();
|
||||||
|
|
||||||
psiMaxn =
|
psiMaxn =
|
||||||
V*((rho/deltaT - Sp)*psiMaxn - Su)
|
V*((rho/deltaT - Sp)*psiMaxn - Su)
|
||||||
- (mesh.V0()/deltaT)*rho.oldTime()*psi0
|
- (V0()/deltaT)*rho.oldTime()*psi0
|
||||||
+ sumPhiBD;
|
+ sumPhiBD;
|
||||||
|
|
||||||
psiMinn =
|
psiMinn =
|
||||||
V*(Su - (rho/deltaT - Sp)*psiMinn)
|
V*(Su - (rho/deltaT - Sp)*psiMinn)
|
||||||
+ (mesh.V0()/deltaT)*rho.oldTime()*psi0
|
+ (V0/deltaT)*rho.oldTime()*psi0
|
||||||
- sumPhiBD;
|
- sumPhiBD;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -269,6 +269,12 @@ public:
|
|||||||
//- Return old-old-time cell volumes
|
//- Return old-old-time cell volumes
|
||||||
const DimensionedField<scalar, volMesh>& V00() const;
|
const DimensionedField<scalar, volMesh>& V00() const;
|
||||||
|
|
||||||
|
//- Return sub-cycle cell volumes
|
||||||
|
tmp<DimensionedField<scalar, volMesh> > Vsc() const;
|
||||||
|
|
||||||
|
//- Return sub-cycl old-time cell volumes
|
||||||
|
tmp<DimensionedField<scalar, volMesh> > Vsc0() const;
|
||||||
|
|
||||||
//- Return cell face area vectors
|
//- Return cell face area vectors
|
||||||
const surfaceVectorField& Sf() const;
|
const surfaceVectorField& Sf() const;
|
||||||
|
|
||||||
|
|||||||
@ -285,6 +285,63 @@ const volScalarField::DimensionedInternalField& fvMesh::V00() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<volScalarField::DimensionedInternalField> fvMesh::Vsc() const
|
||||||
|
{
|
||||||
|
if (moving() && time().subCycling())
|
||||||
|
{
|
||||||
|
const TimeState& ts = time();
|
||||||
|
const TimeState& ts0 = time().prevTimeState();
|
||||||
|
|
||||||
|
scalar tFrac =
|
||||||
|
(
|
||||||
|
ts.value() - (ts0.value() - ts0.deltaTValue())
|
||||||
|
)/ts0.deltaTValue();
|
||||||
|
|
||||||
|
if (tFrac < (1 - SMALL))
|
||||||
|
{
|
||||||
|
return V0() + tFrac*(V() - V0());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return V();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return V();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tmp<volScalarField::DimensionedInternalField> fvMesh::Vsc0() const
|
||||||
|
{
|
||||||
|
if (moving() && time().subCycling())
|
||||||
|
{
|
||||||
|
const TimeState& ts = time();
|
||||||
|
const TimeState& ts0 = time().prevTimeState();
|
||||||
|
|
||||||
|
scalar t0Frac =
|
||||||
|
(
|
||||||
|
(ts.value() - ts.deltaTValue())
|
||||||
|
- (ts0.value() - ts0.deltaTValue())
|
||||||
|
)/ts0.deltaTValue();
|
||||||
|
|
||||||
|
if (t0Frac > SMALL)
|
||||||
|
{
|
||||||
|
return V0() + t0Frac*(V() - V0());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return V0();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return V0();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const surfaceVectorField& fvMesh::Sf() const
|
const surfaceVectorField& fvMesh::Sf() const
|
||||||
{
|
{
|
||||||
if (!SfPtr_)
|
if (!SfPtr_)
|
||||||
|
|||||||
@ -37,7 +37,8 @@ boundaryField
|
|||||||
centreOfMass (0.5 0.5 0.5);
|
centreOfMass (0.5 0.5 0.5);
|
||||||
momentOfInertia (0.08622222 0.08622222 0.144);
|
momentOfInertia (0.08622222 0.08622222 0.144);
|
||||||
mass 9.6;
|
mass 9.6;
|
||||||
rhoInf 1; // for forces calculation
|
rhoInf 1;
|
||||||
|
report on;
|
||||||
value uniform (0 0 0);
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: 1.6.x |
|
| \\ / O peration | Version: dev |
|
||||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
application interDyMFoam;
|
application interDyMFoam;
|
||||||
|
|
||||||
startFrom startTime;
|
startFrom latestTime;
|
||||||
|
|
||||||
startTime 0;
|
startTime 0;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ deltaT 0.01;
|
|||||||
|
|
||||||
writeControl adjustableRunTime;
|
writeControl adjustableRunTime;
|
||||||
|
|
||||||
writeInterval 0.025;
|
writeInterval 0.1;
|
||||||
|
|
||||||
purgeWrite 0;
|
purgeWrite 0;
|
||||||
|
|
||||||
@ -47,9 +47,9 @@ runTimeModifiable yes;
|
|||||||
|
|
||||||
adjustTimeStep yes;
|
adjustTimeStep yes;
|
||||||
|
|
||||||
maxCo 0.2;
|
maxCo 0.5;
|
||||||
|
|
||||||
maxDeltaT 0.025;
|
maxDeltaT 0.01;
|
||||||
|
|
||||||
libs
|
libs
|
||||||
(
|
(
|
||||||
|
|||||||
@ -20,7 +20,7 @@ solvers
|
|||||||
cellDisplacement
|
cellDisplacement
|
||||||
{
|
{
|
||||||
solver GAMG;
|
solver GAMG;
|
||||||
tolerance 1e-08;
|
tolerance 1e-5;
|
||||||
relTol 0;
|
relTol 0;
|
||||||
smoother GaussSeidel;
|
smoother GaussSeidel;
|
||||||
cacheAgglomeration true;
|
cacheAgglomeration true;
|
||||||
@ -35,7 +35,7 @@ solvers
|
|||||||
preconditioner
|
preconditioner
|
||||||
{
|
{
|
||||||
preconditioner GAMG;
|
preconditioner GAMG;
|
||||||
tolerance 1e-05;
|
tolerance 1e-5;
|
||||||
relTol 0;
|
relTol 0;
|
||||||
smoother DICGaussSeidel;
|
smoother DICGaussSeidel;
|
||||||
nPreSweeps 0;
|
nPreSweeps 0;
|
||||||
@ -55,7 +55,7 @@ solvers
|
|||||||
p
|
p
|
||||||
{
|
{
|
||||||
solver GAMG;
|
solver GAMG;
|
||||||
tolerance 1e-08;
|
tolerance 1e-8;
|
||||||
relTol 0.01;
|
relTol 0.01;
|
||||||
smoother DIC;
|
smoother DIC;
|
||||||
nPreSweeps 0;
|
nPreSweeps 0;
|
||||||
@ -73,7 +73,7 @@ solvers
|
|||||||
preconditioner
|
preconditioner
|
||||||
{
|
{
|
||||||
preconditioner GAMG;
|
preconditioner GAMG;
|
||||||
tolerance 2e-09;
|
tolerance 1e-8;
|
||||||
relTol 0;
|
relTol 0;
|
||||||
nVcycles 2;
|
nVcycles 2;
|
||||||
smoother DICGaussSeidel;
|
smoother DICGaussSeidel;
|
||||||
@ -86,7 +86,7 @@ solvers
|
|||||||
mergeLevels 1;
|
mergeLevels 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tolerance 2e-09;
|
tolerance 1e-8;
|
||||||
relTol 0;
|
relTol 0;
|
||||||
maxIter 20;
|
maxIter 20;
|
||||||
}
|
}
|
||||||
@ -95,18 +95,18 @@ solvers
|
|||||||
{
|
{
|
||||||
solver smoothSolver;
|
solver smoothSolver;
|
||||||
smoother GaussSeidel;
|
smoother GaussSeidel;
|
||||||
tolerance 1e-06;
|
tolerance 1e-6;
|
||||||
relTol 0;
|
relTol 0;
|
||||||
nSweeps 1;
|
nSweeps 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
"(k|epsilon|R|nuTilda)"
|
"(k|epsilon|omega|R|nuTilda)"
|
||||||
{
|
{
|
||||||
$U;
|
solver PBiCG;
|
||||||
tolerance 1e-08;
|
preconditioner DILU;
|
||||||
|
tolerance 1e-8;
|
||||||
relTol 0;
|
relTol 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PISO
|
PISO
|
||||||
@ -115,14 +115,14 @@ PISO
|
|||||||
nCorrectors 2;
|
nCorrectors 2;
|
||||||
nNonOrthogonalCorrectors 0;
|
nNonOrthogonalCorrectors 0;
|
||||||
nAlphaCorr 1;
|
nAlphaCorr 1;
|
||||||
nAlphaSubCycles 1;
|
nAlphaSubCycles 3;
|
||||||
cAlpha 1.5;
|
cAlpha 1;
|
||||||
correctPhi yes;
|
correctPhi yes;
|
||||||
}
|
}
|
||||||
|
|
||||||
relaxationFactors
|
relaxationFactors
|
||||||
{
|
{
|
||||||
U 1;
|
"(U|k|epsilon|omega|R|nuTilda)" 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user