erge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.3.x

This commit is contained in:
william 2014-10-15 10:54:49 +01:00
commit 3aee371e7c
13 changed files with 384 additions and 22 deletions

View file

@ -19,16 +19,7 @@
).fvmDiv(phi, alpha1)
);
solve
(
alpha1Eqn
- fv::gaussLaplacianScheme<scalar, scalar>
(
mesh,
linear<scalar>(mesh),
fv::uncorrectedSnGrad<scalar>(mesh)
).fvmLaplacian(fvc::interpolate(turbulence->nut()), alpha1)
);
solve(alpha1Eqn);
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
@ -42,6 +33,7 @@
if (alphaApplyPrevCorr && tphiAlphaCorr0.valid())
{
Info<< "Applying the previous iteration correction flux" << endl;
#ifdef LTSSOLVE
MULES::LTScorrect
(

View file

@ -50,7 +50,6 @@
// Apply the diffusion term separately to allow implicit solution
// and boundedness of the explicit advection
if (!MULESCorr)
{
fvScalarMatrix alpha1Eqn
(

View file

@ -503,6 +503,7 @@ $(mapPolyMesh)/faceMapper/faceMapper.C
$(mapPolyMesh)/cellMapper/cellMapper.C
$(mapPolyMesh)/mapDistribute/mapDistribute.C
$(mapPolyMesh)/mapDistribute/mapDistributePolyMesh.C
$(mapPolyMesh)/mapDistribute/IOmapDistribute.C
$(mapPolyMesh)/mapAddedPolyMesh.C
PrimitivePatch = $(primitiveMesh)/PrimitivePatch

View file

@ -0,0 +1,159 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "IOmapDistribute.H"
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
namespace Foam
{
defineTypeNameAndDebug(IOmapDistribute, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::IOmapDistribute::IOmapDistribute(const IOobject& io)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOmapDistribute::IOmapDistribute(const IOobject&)")
<< "IOmapDistribute " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOmapDistribute does not support automatic rereading."
<< endl;
}
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
}
Foam::IOmapDistribute::IOmapDistribute
(
const IOobject& io,
const mapDistribute& map
)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOmapDistribute::IOmapDistribute(const IOobject&)")
<< "IOmapDistribute " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOmapDistribute does not support automatic rereading."
<< endl;
}
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
else
{
mapDistribute::operator=(map);
}
}
Foam::IOmapDistribute::IOmapDistribute
(
const IOobject& io,
const Xfer<mapDistribute>& map
)
:
regIOobject(io)
{
// Temporary warning
if (io.readOpt() == IOobject::MUST_READ_IF_MODIFIED)
{
WarningIn("IOmapDistribute::IOmapDistribute(const IOobject&)")
<< "IOmapDistribute " << name()
<< " constructed with IOobject::MUST_READ_IF_MODIFIED"
" but IOmapDistribute does not support automatic rereading."
<< endl;
}
mapDistribute::transfer(map());
if
(
(
io.readOpt() == IOobject::MUST_READ
|| io.readOpt() == IOobject::MUST_READ_IF_MODIFIED
)
|| (io.readOpt() == IOobject::READ_IF_PRESENT && headerOk())
)
{
readStream(typeName) >> *this;
close();
}
}
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::IOmapDistribute::~IOmapDistribute()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::IOmapDistribute::readData(Istream& is)
{
return (is >> *this).good();
}
bool Foam::IOmapDistribute::writeData(Ostream& os) const
{
return (os << *this).good();
}
// ************************************************************************* //

View file

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ 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::IOmapDistribute
Description
IOmapDistribute is derived from mapDistribute and
IOobject to give the mapDistribute
automatic IO functionality via the objectRegistry.
SourceFiles
IOmapDistribute.C
\*---------------------------------------------------------------------------*/
#ifndef IOmapDistribute_H
#define IOmapDistribute_H
#include "mapDistribute.H"
#include "regIOobject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class IOmapDistribute Declaration
\*---------------------------------------------------------------------------*/
class IOmapDistribute
:
public regIOobject,
public mapDistribute
{
public:
//- Runtime type information
TypeName("mapDistribute");
// Constructors
//- Construct given an IOobject
IOmapDistribute(const IOobject&);
//- Construct given an IOobject and mapDistribute
IOmapDistribute(const IOobject&, const mapDistribute&);
//- Construct by transferring the mapDistribute contents
IOmapDistribute(const IOobject&, const Xfer<mapDistribute>&);
//- Destructor
virtual ~IOmapDistribute();
// Member functions
//- ReadData function required for regIOobject read operation
virtual bool readData(Istream&);
//- WriteData function required for regIOobject write operation
virtual bool writeData(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1341,4 +1341,31 @@ void Foam::mapDistribute::operator=(const mapDistribute& rhs)
}
// * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, mapDistribute& map)
{
is.fatalCheck("operator>>(Istream&, mapDistribute&)");
is >> map.constructSize_ >> map.subMap_ >> map.constructMap_
>> map.transformElements_ >> map.transformStart_;
return is;
}
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const mapDistribute& map)
{
os << map.constructSize_ << token::NL
<< map.subMap_ << token::NL
<< map.constructMap_ << token::NL
<< map.transformElements_ << token::NL
<< map.transformStart_ << token::NL;
return os;
}
// ************************************************************************* //

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -676,6 +676,15 @@ public:
void operator=(const mapDistribute&);
// IOstream operators
//- Read dictionary from Istream
friend Istream& operator>>(Istream&, mapDistribute&);
//- Write dictionary to Ostream
friend Ostream& operator<<(Ostream&, const mapDistribute&);
};

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -107,6 +107,7 @@ void Foam::MULES::correct
psiMax, psiMin,
nLimiterIter
);
correct(rDeltaT, rho, psi, phi, phiCorr, Sp, Su);
}
@ -172,6 +173,13 @@ void Foam::MULES::limiterCorr
const fvMesh& mesh = psi.mesh();
const dictionary& MULEScontrols = mesh.solverDict(psi.name());
scalar extremaCoeff
(
MULEScontrols.lookupOrDefault<scalar>("extremaCoeff", 0.0)
);
const labelUList& owner = mesh.owner();
const labelUList& neighb = mesh.neighbour();
tmp<volScalarField::DimensionedInternalField> tVsc = mesh.Vsc();
@ -283,8 +291,8 @@ void Foam::MULES::limiterCorr
}
}
psiMaxn = min(psiMaxn, psiMax);
psiMinn = max(psiMinn, psiMin);
psiMaxn = min(psiMaxn + extremaCoeff*(psiMax - psiMin), psiMax);
psiMinn = max(psiMinn - extremaCoeff*(psiMax - psiMin), psiMin);
// scalar smooth = 0.5;
// psiMaxn = min((1.0 - smooth)*psiIf + smooth*psiMaxn, psiMax);

View file

@ -334,8 +334,14 @@ bool Foam::KinematicParcel<ParcelType>::move
p.stepFraction() = newStepFraction;
bool calcParcel = true;
if (!tracking && td.cloud().solution().steadyState())
{
calcParcel = false;
}
// Avoid problems with extremely small timesteps
if (dt > ROOTVSMALL)
if ((dt > ROOTVSMALL) && calcParcel)
{
// Update cell based properties
p.setCellValues(td, dt, cellI);

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -700,4 +700,38 @@ Foam::label Foam::edgeIntersections::removeDegenerates
}
void Foam::edgeIntersections::replace
(
const edgeIntersections& subInfo,
const labelList& edgeMap,
const labelList& faceMap
)
{
forAll(subInfo, subI)
{
const List<pointIndexHit>& subHits = subInfo[subI];
const labelList& subClass = subInfo.classification()[subI];
label edgeI = edgeMap[subI];
List<pointIndexHit>& intersections = operator[](edgeI);
labelList& intersectionTypes = classification_[edgeI];
intersections.setSize(subHits.size());
intersectionTypes.setSize(subHits.size());
forAll(subHits, i)
{
const pointIndexHit& subHit = subHits[i];
intersections[i] = pointIndexHit
(
subHit.hit(),
subHit.rawPoint(),
faceMap[subHit.index()]
);
intersectionTypes[i] = subClass[i];
}
}
}
// ************************************************************************* //

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -197,6 +197,15 @@ public:
const scalarField& surf1PointTol,
pointField& points1
);
//- Replace edge intersection for a subset (given as edge map and
// face map - for face indices stored in pointIndexHit.index())
void replace
(
const edgeIntersections&,
const labelList& edgeMap,
const labelList& faceMap
);
};

View file

@ -69,6 +69,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
q_(p.size(), 0.0),
h_(p.size(), 0.0),
Ta_(p.size(), 0.0),
QrName_("undefined-Qr"),
thicknessLayers_(),
kappaLayers_()
{
@ -93,6 +94,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
q_(ptf.q_, mapper),
h_(ptf.h_, mapper),
Ta_(ptf.Ta_, mapper),
QrName_(ptf.QrName_),
thicknessLayers_(ptf.thicknessLayers_),
kappaLayers_(ptf.kappaLayers_)
{}
@ -112,6 +114,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
q_(p.size(), 0.0),
h_(p.size(), 0.0),
Ta_(p.size(), 0.0),
QrName_(dict.lookupOrDefault<word>("Qr", "none")),
thicknessLayers_(),
kappaLayers_()
{
@ -181,6 +184,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
q_(tppsf.q_),
h_(tppsf.h_),
Ta_(tppsf.Ta_),
QrName_(tppsf.QrName_),
thicknessLayers_(tppsf.thicknessLayers_),
kappaLayers_(tppsf.kappaLayers_)
{}
@ -199,6 +203,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
q_(tppsf.q_),
h_(tppsf.h_),
Ta_(tppsf.Ta_),
QrName_(tppsf.QrName_),
thicknessLayers_(tppsf.thicknessLayers_),
kappaLayers_(tppsf.kappaLayers_)
{}
@ -245,6 +250,12 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
const scalarField Tp(*this);
scalarField hp(patch().size(), 0.0);
scalarField Qr(Tp.size(), 0.0);
if (QrName_ != "none")
{
Qr = patch().lookupPatchField<volScalarField, scalar>(QrName_);
}
switch (mode_)
{
case fixedHeatFlux:
@ -281,15 +292,17 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
if (mode_ == fixedHeatFlux)
{
refGrad() = q_/kappa(Tp);
refGrad() = (q_ + Qr)/kappa(Tp);
refValue() = 0.0;
valueFraction() = 0.0;
}
else if (mode_ == fixedHeatTransferCoeff)
{
Qr /= Tp;
refGrad() = 0.0;
refValue() = Ta_;
valueFraction() = hp/(hp + kappa(Tp)*patch().deltaCoeffs());
refValue() = hp*Ta_/(hp - Qr);
valueFraction() =
(hp - Qr)/((hp - Qr) + kappa(Tp)*patch().deltaCoeffs());
}
mixedFvPatchScalarField::updateCoeffs();
@ -318,9 +331,11 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write
{
mixedFvPatchScalarField::write(os);
temperatureCoupledBase::write(os);
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
switch (mode_)
{
case fixedHeatFlux:
{
q_.writeEntry("q", os);

View file

@ -60,6 +60,7 @@ Description
thicknessLayers | list of thicknesses per layer [m] | yes |
kappaLayers | list of thermal conductivites per layer [W/m/K] | yes |
kappaName | name of thermal conductivity field | yes |
QrName | name of the radiative field | no | no
\endtable
Example of the boundary condition specification:
@ -75,6 +76,7 @@ Description
kappaLayers (1 2 3 4)
value uniform 300.0;
kappaName none;
QrName none;
}
\endverbatim
@ -137,6 +139,9 @@ private:
//- Ambient temperature / [K]
scalarField Ta_;
//- Name of the radiative heat flux
const word QrName_;
//- Thickness of layers
scalarList thicknessLayers_;