mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -625,21 +625,25 @@ void Foam::Time::setDeltaT(const scalar deltaT)
|
||||
Foam::TimeState Foam::Time::subCycle(const label nSubCycles)
|
||||
{
|
||||
subCycling_ = true;
|
||||
prevTimeState_.set(new TimeState(*this));
|
||||
|
||||
TimeState ts = *this;
|
||||
setTime(*this - deltaT(), (timeIndex() - 1)*nSubCycles);
|
||||
deltaT_ /= nSubCycles;
|
||||
deltaT0_ /= nSubCycles;
|
||||
deltaTSave_ = deltaT0_;
|
||||
|
||||
return ts;
|
||||
return prevTimeState();
|
||||
}
|
||||
|
||||
|
||||
void Foam::Time::endSubCycle(const TimeState& ts)
|
||||
void Foam::Time::endSubCycle()
|
||||
{
|
||||
subCycling_ = false;
|
||||
TimeState::operator=(ts);
|
||||
if (subCycling_)
|
||||
{
|
||||
subCycling_ = false;
|
||||
TimeState::operator=(prevTimeState());
|
||||
prevTimeState_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -127,6 +127,9 @@ protected:
|
||||
//- Is the time currently being sub-cycled?
|
||||
bool subCycling_;
|
||||
|
||||
//- If time is being sub-cycled this is the previous TimeState
|
||||
autoPtr<TimeState> prevTimeState_;
|
||||
|
||||
//- Time directory name format
|
||||
static fmtflags format_;
|
||||
|
||||
@ -347,6 +350,18 @@ public:
|
||||
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
|
||||
|
||||
@ -427,8 +442,8 @@ public:
|
||||
//- Set time to sub-cycle for the given number of steps
|
||||
virtual TimeState subCycle(const label nSubCycles);
|
||||
|
||||
//- Reset time after sub-cycling back to given TimeState
|
||||
virtual void endSubCycle(const TimeState&);
|
||||
//- Reset time after sub-cycling back to previous TimeState
|
||||
virtual void endSubCycle();
|
||||
|
||||
//- Return non-const access to the list of function objects
|
||||
functionObjectList& functionObjects()
|
||||
|
||||
@ -32,9 +32,10 @@ Foam::subCycleTime::subCycleTime(Time& t, const label nSubCycles)
|
||||
:
|
||||
time_(t),
|
||||
nSubCycles_(nSubCycles),
|
||||
subCycleIndex_(0),
|
||||
initialTimeState_(time_.subCycle(nSubCycles_))
|
||||
{}
|
||||
subCycleIndex_(0)
|
||||
{
|
||||
time_.subCycle(nSubCycles_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
@ -55,7 +56,7 @@ bool Foam::subCycleTime::end() const
|
||||
|
||||
void Foam::subCycleTime::endSubCycle()
|
||||
{
|
||||
time_.endSubCycle(initialTimeState_);
|
||||
time_.endSubCycle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -55,7 +55,6 @@ class subCycleTime
|
||||
|
||||
label nSubCycles_;
|
||||
label subCycleIndex_;
|
||||
TimeState initialTimeState_;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -242,7 +242,6 @@ $(limitedSchemes)/SuperBee/SuperBee.C
|
||||
$(limitedSchemes)/QUICK/QUICK.C
|
||||
$(limitedSchemes)/MUSCL/MUSCL.C
|
||||
$(limitedSchemes)/UMIST/UMIST.C
|
||||
$(limitedSchemes)/MC/MC.C
|
||||
$(limitedSchemes)/Phi/Phi.C
|
||||
$(limitedSchemes)/filteredLinear/filteredLinear.C
|
||||
$(limitedSchemes)/filteredLinear2/filteredLinear2.C
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,6 +34,7 @@ License
|
||||
#include "fvcSurfaceIntegrate.H"
|
||||
#include "slicedSurfaceFields.H"
|
||||
#include "syncTools.H"
|
||||
|
||||
#include "fvm.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -107,7 +108,7 @@ void Foam::MULES::explicitSolve
|
||||
{
|
||||
psiIf =
|
||||
(
|
||||
mesh.V0()*rho.oldTime()*psi0/(deltaT*mesh.V())
|
||||
mesh.Vsc0()*rho.oldTime()*psi0/(deltaT*mesh.Vsc())
|
||||
+ Su.field()
|
||||
- psiIf
|
||||
)/(rho/deltaT - Sp.field());
|
||||
@ -325,7 +326,8 @@ void Foam::MULES::limiter
|
||||
|
||||
const unallocLabelList& owner = mesh.owner();
|
||||
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 scalarField& phiBDIf = phiBD;
|
||||
@ -452,14 +454,16 @@ void Foam::MULES::limiter
|
||||
|
||||
if (mesh.moving())
|
||||
{
|
||||
tmp<volScalarField::DimensionedInternalField> V0 = mesh.Vsc0();
|
||||
|
||||
psiMaxn =
|
||||
V*((rho/deltaT - Sp)*psiMaxn - Su)
|
||||
- (mesh.V0()/deltaT)*rho.oldTime()*psi0
|
||||
- (V0()/deltaT)*rho.oldTime()*psi0
|
||||
+ sumPhiBD;
|
||||
|
||||
psiMinn =
|
||||
V*(Su - (rho/deltaT - Sp)*psiMinn)
|
||||
+ (mesh.V0()/deltaT)*rho.oldTime()*psi0
|
||||
+ (V0/deltaT)*rho.oldTime()*psi0
|
||||
- sumPhiBD;
|
||||
}
|
||||
else
|
||||
|
||||
@ -269,6 +269,12 @@ public:
|
||||
//- Return old-old-time cell volumes
|
||||
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
|
||||
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
|
||||
{
|
||||
if (!SfPtr_)
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "LimitedScheme.H"
|
||||
#include "MC.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeLimitedSurfaceInterpolationScheme(MC, MCLimiter)
|
||||
makeLimitedVSurfaceInterpolationScheme(MCV, MCLimiter)
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,94 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::MCLimiter
|
||||
|
||||
Description
|
||||
Class with limiter function which returns the limiter for the
|
||||
monotonised centred differencing scheme based on r obtained from
|
||||
the LimiterFunc class.
|
||||
|
||||
Used in conjunction with the template class LimitedScheme.
|
||||
|
||||
SourceFiles
|
||||
MC.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MC_H
|
||||
#define MC_H
|
||||
|
||||
#include "vector.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class MCLimiter Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class LimiterFunc>
|
||||
class MCLimiter
|
||||
:
|
||||
public LimiterFunc
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
MCLimiter(Istream&)
|
||||
{}
|
||||
|
||||
scalar limiter
|
||||
(
|
||||
const scalar cdWeight,
|
||||
const scalar faceFlux,
|
||||
const typename LimiterFunc::phiType& phiP,
|
||||
const typename LimiterFunc::phiType& phiN,
|
||||
const typename LimiterFunc::gradPhiType& gradcP,
|
||||
const typename LimiterFunc::gradPhiType& gradcN,
|
||||
const vector& d
|
||||
) const
|
||||
{
|
||||
scalar r = LimiterFunc::r
|
||||
(
|
||||
faceFlux, phiP, phiN, gradcP, gradcN, d
|
||||
);
|
||||
|
||||
return max(min(min(2*r, 0.5*(1 + r)), 2), 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user