Commit 034176f8 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

parents 84463252 3f2d0519
......@@ -27,11 +27,13 @@ License
#include "alphaContactAngleFvPatchScalarField.H"
#include "Time.H"
#include "subCycle.H"
#include "fvCFD.H"
#include "MULES.H"
#include "fvcSnGrad.H"
#include "fvcFlux.H"
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
const scalar Foam::multiphaseMixture::convertToRad =
const Foam::scalar Foam::multiphaseMixture::convertToRad =
Foam::constant::mathematical::pi/180.0;
......@@ -249,10 +251,6 @@ void Foam::multiphaseMixture::solve()
label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles")));
label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr")));
bool cycleAlpha(Switch(pimpleDict.lookup("cycleAlpha")));
scalar cAlpha(readScalar(pimpleDict.lookup("cAlpha")));
......@@ -269,7 +267,7 @@ void Foam::multiphaseMixture::solve()
!(++alphaSubCycle).end();
)
{
solveAlphas(nAlphaCorr, cycleAlpha, cAlpha);
solveAlphas(cAlpha);
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi_;
}
......@@ -277,7 +275,7 @@ void Foam::multiphaseMixture::solve()
}
else
{
solveAlphas(nAlphaCorr, cycleAlpha, cAlpha);
solveAlphas(cAlpha);
}
}
......@@ -481,8 +479,6 @@ Foam::multiphaseMixture::nearInterface() const
void Foam::multiphaseMixture::solveAlphas
(
const label nAlphaCorr,
const bool cycleAlpha,
const scalar cAlpha
)
{
......@@ -490,92 +486,108 @@ void Foam::multiphaseMixture::solveAlphas
nSolves++;
word alphaScheme("div(phi,alpha)");
word alphacScheme("div(phirb,alpha)");
tmp<fv::convectionScheme<scalar> > mvConvection
(
fv::convectionScheme<scalar>::New
(
mesh_,
alphaTable_,
phi_,
mesh_.divScheme(alphaScheme)
)
);
word alpharScheme("div(phirb,alpha)");
surfaceScalarField phic(mag(phi_/mesh_.magSf()));
phic = min(cAlpha*phic, max(phic));
for (int gCorr=0; gCorr<nAlphaCorr; gCorr++)
{
phase* refPhasePtr = &refPhase_;
if (cycleAlpha)
{
PtrDictionary<phase>::iterator refPhaseIter = phases_.begin();
for (label i=0; i<nSolves%phases_.size(); i++)
{
++refPhaseIter;
}
refPhasePtr = &refPhaseIter();
}
PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size());
int phasei = 0;
phase& refPhase = *refPhasePtr;
forAllIter(PtrDictionary<phase>, phases_, iter)
{
phase& alpha = iter();
volScalarField refPhaseNew(refPhase);
refPhaseNew == 1.0;
phiAlphaCorrs.set
(
phasei,
new surfaceScalarField
(
fvc::flux
(
phi_,
alpha,
alphaScheme
)
)
);
rhoPhi_ = phi_*refPhase.rho();
surfaceScalarField& phiAlphaCorr = phiAlphaCorrs[phasei];
forAllIter(PtrDictionary<phase>, phases_, iter)
forAllIter(PtrDictionary<phase>, phases_, iter2)
{
phase& alpha = iter();
phase& alpha2 = iter2();
if (&alpha2 == &alpha) continue;
if (&alpha == &refPhase) continue;
surfaceScalarField phir(phic*nHatf(alpha, alpha2));
fvScalarMatrix alphaEqn
phiAlphaCorr += fvc::flux
(
fvm::ddt(alpha)
+ mvConvection->fvmDiv(phi_, alpha)
-fvc::flux(-phir, alpha2, alpharScheme),
alpha,
alpharScheme
);
}
forAllIter(PtrDictionary<phase>, phases_, iter2)
{
phase& alpha2 = iter2();
if (&alpha2 == &alpha) continue;
surfaceScalarField phir(phic*nHatf(alpha, alpha2));
surfaceScalarField phirb12
(
-fvc::flux(-phir, alpha2, alphacScheme)
);
MULES::limit
(
geometricOneField(),
alpha,
phi_,
phiAlphaCorr,
zeroField(),
zeroField(),
1,
0,
3,
true
);
phasei++;
}
alphaEqn += fvm::div(phirb12, alpha, alphacScheme);
}
MULES::limitSum(phiAlphaCorrs);
alphaEqn.solve(mesh_.solver("alpha"));
rhoPhi_ = 0.0*phi_*refPhase_.rho();
volScalarField sumAlpha("sumAlpha", 0.0*refPhase_);
phasei = 0;
rhoPhi_ += alphaEqn.flux()*(alpha.rho() - refPhase.rho());
forAllIter(PtrDictionary<phase>, phases_, iter)
{
phase& alpha = iter();
Info<< alpha.name() << " volume fraction, min, max = "
<< alpha.weightedAverage(mesh_.V()).value()
<< ' ' << min(alpha).value()
<< ' ' << max(alpha).value()
<< endl;
surfaceScalarField& phiAlpha = phiAlphaCorrs[phasei];
phiAlpha += upwind<scalar>(mesh_, phi_).flux(alpha);
refPhaseNew == refPhaseNew - alpha;
}
MULES::explicitSolve
(
geometricOneField(),
alpha,
phiAlpha,
zeroField(),
zeroField()
);
rhoPhi_ += phiAlpha*alpha.rho();
Info<< alpha.name() << " volume fraction, min, max = "
<< alpha.weightedAverage(mesh_.V()).value()
<< ' ' << min(alpha).value()
<< ' ' << max(alpha).value()
<< endl;
refPhase == refPhaseNew;
sumAlpha += alpha;
Info<< refPhase.name() << " volume fraction, min, max = "
<< refPhase.weightedAverage(mesh_.V()).value()
<< ' ' << min(refPhase).value()
<< ' ' << max(refPhase).value()
<< endl;
phasei++;
}
Info<< "Phase-sum volume fraction, min, max = "
<< sumAlpha.weightedAverage(mesh_.V()).value()
<< ' ' << min(sumAlpha).value()
<< ' ' << max(sumAlpha).value()
<< endl;
calcAlphas();
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -168,12 +168,7 @@ private:
void calcAlphas();
void solveAlphas
(
const label nAlphaCorr,
const bool cycleAlpha,
const scalar cAlpha
);
void solveAlphas(const scalar cAlpha);
tmp<surfaceVectorField> nHatfv
(
......
......@@ -9,7 +9,7 @@ wmake snappyHexMesh
if [ -d "$CGAL_ARCH_PATH" ]
then
wmake cvMesh
cd cvMesh && ./Allwmake
fi
# ----------------------------------------------------------------- end-of-file
......@@ -105,19 +105,19 @@ int main(int argc, char *argv[])
"file",
"specify an alternative dictionary for the topoSet dictionary"
);
# include "addRegionOption.H"
#include "addRegionOption.H"
argList::addBoolOption
(
"noSync",
"do not synchronise selection across coupled patches"
);
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::selectIfPresent(runTime, args);
# include "createNamedPolyMesh.H"
#include "createNamedPolyMesh.H"
const bool noSync = args.optionFound("noSync");
......
......@@ -912,7 +912,7 @@ DimensionedConstants
}
electromagnetic
{
e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19;
e e [ 0 0 1 0 0 1 0 ] 1.60218e-19;
}
atomic
{
......@@ -942,7 +942,7 @@ DimensionedConstants
}
electromagnetic
{
e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19;
e e [ 0 0 1 0 0 1 0 ] 1.60218e-19;
}
atomic
{
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -56,7 +56,7 @@ Foam::Istream& Foam::operator>>(Foam::Istream& is, FixedList<T, Size>& L)
{
L = dynamicCast<token::Compound<List<T> > >
(
firstToken.transferCompoundToken()
firstToken.transferCompoundToken(is)
);
}
else if (firstToken.isLabel())
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -59,7 +59,7 @@ Foam::Istream& Foam::operator>>(Istream& is, List<T>& L)
(
dynamicCast<token::Compound<List<T> > >
(
firstToken.transferCompoundToken()
firstToken.transferCompoundToken(is)
)
);
}
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 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 3 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, see <http://www.gnu.org/licenses/>.
Class
Foam::CompoundToken
Description
An abstract base class for managing compound tokens
\*---------------------------------------------------------------------------*/
#ifndef CompoundToken_H
#define CompoundToken_H
#include "refCount.H"
#include "typeInfo.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
class CompoundToken;
Ostream& operator<<(Ostream&, const CompoundToken&);
/*---------------------------------------------------------------------------*\
Class CompoundToken Declaration
\*---------------------------------------------------------------------------*/
class CompoundToken
:
public refCount
{
// Private Member Functions
//- Disallow default bitwise copy construct
CompoundToken(const CompoundToken&);
//- Disallow default bitwise assignment
void operator=(const CompoundToken&);
public:
//- Runtime type information
virtual const word& type() const = 0;
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
CompoundToken,
Istream,
(const word& type, Istream& is),
(type, is)
);
// Constructors
//- Construct null
CompoundToken()
{}
//- Return the clone as this and increment reference count
virtual autoPtr<CompoundToken> clone() const = 0;
// Selectors
//- Select null constructed
static autoPtr<CompoundToken> New(const word& type, Istream& is);
//- Destructor
virtual ~CompoundToken();
// Member Functions
// Access
// Check
// Edit
// Write
virtual void write(Istream&) = 0;
// IOstream Operators
friend Ostream& operator<<(Ostream&, const CompoundToken&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -63,11 +63,11 @@ Foam::autoPtr<Foam::token::compound> Foam::token::compound::New
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalErrorIn("token::compound::New(const word&, Istream&)")
FatalIOErrorIn("token::compound::New(const word&, Istream&)", is)
<< "Unknown compound type " << compoundType << nl << nl
<< "Valid compound types:" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< abort(FatalError);
<< abort(FatalIOError);
}
return autoPtr<Foam::token::compound>(cstrIter()(is));
......@@ -86,15 +86,18 @@ bool Foam::token::compound::isCompound(const word& name)
}
Foam::token::compound& Foam::token::transferCompoundToken()
Foam::token::compound& Foam::token::transferCompoundToken(const Istream& is)
{
if (type_ == COMPOUND)
{
if (compoundTokenPtr_->empty())
{
FatalErrorIn("token::transferCompoundToken()")
<< "compound has already been transfered from token\n "
<< info() << abort(FatalError);
FatalIOErrorIn
(
"token::transferCompoundToken(const Istream& is)",
is
) << "compound has already been transfered from token\n "
<< info() << abort(FatalIOError);
}
else
{
......
......@@ -351,7 +351,7 @@ public:
inline bool isCompound() const;
inline const compound& compoundToken() const;
compound& transferCompoundToken();
compound& transferCompoundToken(const Istream& is);
inline label lineNumber() const;
inline label& lineNumber();
......
......@@ -44,7 +44,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
dimensionedScalar
(
"mu0",
dimensionSet(1, 2, -1, 0, 0, -2, 0),
dimensionSet(1, 1, -2, 0, 0, -2, 0),
4.0*constant::mathematical::pi*1e-07
)
)
......
......@@ -145,7 +145,6 @@ Foam::pointField Foam::coupledPolyPatch::getAnchorPoints
Foam::scalarField Foam::coupledPolyPatch::calcFaceTol
(
const scalar matchTol,
const UList<face>& faces,
const pointField& points,
const pointField& faceCentres
......@@ -173,7 +172,7 @@ Foam::scalarField Foam::coupledPolyPatch::calcFaceTol
maxLenSqr = max(maxLenSqr, magSqr(pt - cc));
maxCmpt = max(maxCmpt, cmptMax(cmptMag(pt)));
}
tols[faceI] = max(SMALL*maxCmpt, matchTol*Foam::sqrt(maxLenSqr));
tols[faceI] = max(SMALL*maxCmpt, Foam::sqrt(maxLenSqr));
}
return tols;
}
......
......@@ -160,7 +160,6 @@ protected:
// from face centre to any of the face vertices.
static scalarField calcFaceTol
(
const scalar matchTol,
const UList<face>& faces,
const pointField& points,
const pointField& faceCentres
......
......@@ -304,9 +304,9 @@ void Foam::cyclicPolyPatch::calcTransforms
{
scalarField half0Tols
(
calcFaceTol
matchTolerance()
*calcFaceTol
(
matchTolerance(),
half0,
half0.points(),
static_cast<const pointField&>(half0Ctrs)
......@@ -562,7 +562,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
// Calculate typical distance per face
tols = calcFaceTol(matchTolerance(), pp1, pp1.points(), half1Ctrs);
tols = matchTolerance()*calcFaceTol(pp1, pp1.points(), half1Ctrs);
}
......
......@@ -444,7 +444,7 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors
// Calculate typical distance per face
tols = calcFaceTol(matchTolerance(), half1Faces, pp.points(), half1Ctrs);
tols = matchTolerance()*calcFaceTol(half1Faces, pp.points(), half1Ctrs);
}
......
......@@ -179,6 +179,10 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)