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

This commit is contained in:
andy
2012-04-10 14:25:23 +01:00
149 changed files with 5782 additions and 9176 deletions

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -106,6 +106,7 @@ AccessType ListListOps::combineOffset
return result;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -92,10 +92,8 @@ SourceFiles
namespace Foam
{
//
//template <class T> class accessOp;
//template <class T> class offsetOp;
// Dummy access operator for combine()
// Dummy access operator for ListListOps::combine()
template <class T>
class accessOp
{
@ -108,7 +106,7 @@ public:
};
// Offset operator for combineOffset()
// Offset operator for ListListOps::combineOffset()
template <class T>
class offsetOp
{

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -126,8 +126,30 @@ dimensioned<Type>::dimensioned
:
name_(name),
dimensions_(dimSet),
value_(pTraits<Type>(is))
{}
value_(pTraits<Type>::zero)
{
token nextToken(is);
is.putBack(nextToken);
if (nextToken == token::BEGIN_SQR)
{
dimensionSet dims(is);
if (dims != dimensions_)
{
FatalErrorIn
(
"dimensioned<Type>::dimensioned"
"(const word&, const dimensionSet&, Istream&)"
) << "The dimensions " << dims
<< " provided do not match the required dimensions "
<< dimensions_
<< abort(FatalError);
}
}
is >> value_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -50,6 +50,7 @@ SourceFiles
#include "faceListFwd.H"
#include "intersection.H"
#include "pointHit.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -386,6 +387,30 @@ public:
};
//- Hash specialization to offset faces in ListListOps::combineOffset
template<>
class offsetOp<face>
{
public:
inline face operator()
(
const face& x,
const label offset
) const
{
face result(x.size());
forAll(x, xI)
{
result[xI] = x[xI] + offset;
}
return result;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,6 +46,7 @@ SourceFiles
#include "intersection.H"
#include "pointField.H"
#include "triPointRef.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -249,6 +250,30 @@ template<>
inline bool contiguous<triFace>() {return true;}
//- Hash specialization to offset faces in ListListOps::combineOffset
template<>
class offsetOp<triFace>
{
public:
inline triFace operator()
(
const triFace& x,
const label offset
) const
{
triFace result(x);
forAll(x, xI)
{
result[xI] = x[xI] + offset;
}
return result;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -544,7 +544,7 @@ public:
const labelListList& globalEdgeSlaves() const;
const labelListList& globalEdgeTransformedSlaves() const;
const mapDistribute& globalEdgeSlavesMap() const;
//- Is my edge same orientation master edge
//- Is my edge same orientation as master edge
const PackedBoolList& globalEdgeOrientation() const;
// Coupled point to boundary faces. These are uncoupled boundary

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1092,7 +1092,8 @@ const Foam::pointField& Foam::polyMesh::oldPoints() const
Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
(
const pointField& newPoints
const pointField& newPoints,
const bool deleteDemandDrivenData
)
{
if (debug)
@ -1146,6 +1147,14 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints
// Force recalculation of all geometric data with new points
if (deleteDemandDrivenData)
{
// Remove the stored tet base points
tetBasePtIsPtr_.clear();
// Remove the cell tree
cellTreePtr_.clear();
}
bounds_ = boundBox(points_);
boundary_.movePoints(points_);

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -442,7 +442,11 @@ public:
}
//- Move points, returns volumes swept by faces in motion
virtual tmp<scalarField> movePoints(const pointField&);
virtual tmp<scalarField> movePoints
(
const pointField&,
const bool deleteDemandDrivenData = false
);
//- Reset motion
void resetMotion() const;

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -614,10 +614,17 @@ Foam::polyMesh::polyMesh
label nAllPatches = boundaryFaces.size();
if (nFaces > defaultPatchStart)
label nDefaultFaces = nFaces - defaultPatchStart;
if (syncPar)
{
reduce(nDefaultFaces, sumOp<label>());
}
if (nDefaultFaces > 0)
{
WarningIn("polyMesh::polyMesh(... construct from shapes...)")
<< "Found " << nFaces - defaultPatchStart
<< "Found " << nDefaultFaces
<< " undefined faces in mesh; adding to default patch." << endl;
// Check if there already exists a defaultFaces patch as last patch
@ -883,10 +890,16 @@ Foam::polyMesh::polyMesh
label nAllPatches = boundaryFaces.size();
if (nFaces > defaultPatchStart)
label nDefaultFaces = nFaces - defaultPatchStart;
if (syncPar)
{
reduce(nDefaultFaces, sumOp<label>());
}
if (nDefaultFaces > 0)
{
WarningIn("polyMesh::polyMesh(... construct from shapes...)")
<< "Found " << nFaces - defaultPatchStart
<< "Found " << nDefaultFaces
<< " undefined faces in mesh; adding to default patch." << endl;
// Check if there already exists a defaultFaces patch as last patch

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -407,9 +407,12 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
clearGeom();
points_.instance() = pointsInst;
points_ = pointIOField
label nOldPoints = points_.size();
points_.clear();
pointIOField newPoints
(
IOobject
(
@ -423,6 +426,19 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
)
);
if (nOldPoints != 0 && nOldPoints != newPoints.size())
{
FatalErrorIn("polyMesh::readUpdate()")
<< "Point motion detected but number of points "
<< newPoints.size() << " in "
<< newPoints.objectPath() << " does not correspond to "
<< " current " << nOldPoints
<< exit(FatalError);
}
points_.transfer(newPoints);
points_.instance() = pointsInst;
// Derived info
bounds_ = boundBox(points_);

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -197,7 +197,7 @@ Foam::label Foam::polyMeshTetDecomposition::findBasePoint
}
// If a base point hasn't triggered a return by now, then there is
// non that can produce a good decomposition
// none that can produce a good decomposition
return -1;
}

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,6 +27,7 @@ License
#include "PatchToolsCheck.C"
#include "PatchToolsEdgeOwner.C"
#include "PatchToolsGatherAndMerge.C"
#include "PatchToolsSearch.C"
#include "PatchToolsSortEdges.C"
#include "PatchToolsNormals.C"

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,6 +33,7 @@ SourceFiles
PatchTools.C
PatchToolsCheck.C
PatchToolsEdgeOwner.C
PatchToolsGatherAndMerge.C
PatchToolsSearch.C
PatchToolsSortEdges.C
PatchToolsNormals.C
@ -236,6 +237,25 @@ public:
const labelList& meshFaces
);
//- Gather points and faces onto master and merge (geometrically) into
// single patch.
template
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
static void gatherAndMerge
(
const scalar mergeDist,
const PrimitivePatch<Face, FaceList, PointField, PointType>& p,
Field<PointType>& mergedPoints,
List<Face>& mergedFaces,
labelList& pointMergeMap
);
};

View File

@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "PatchTools.H"
#include "ListListOps.H"
#include "mergePoints.H"
#include "face.H"
#include "triFace.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
void Foam::PatchTools::gatherAndMerge
(
const scalar mergeDist,
const PrimitivePatch<Face, FaceList, PointField, PointType>& p,
Field<PointType>& mergedPoints,
List<Face>& mergedFaces,
labelList& pointMergeMap
)
{
// Collect points from all processors
labelList pointSizes;
{
List<Field<PointType> > gatheredPoints(Pstream::nProcs());
gatheredPoints[Pstream::myProcNo()] = p.localPoints();
Pstream::gatherList(gatheredPoints);
if (Pstream::master())
{
pointSizes = ListListOps::subSizes
(
gatheredPoints,
accessOp<Field<PointType> >()
);
mergedPoints = ListListOps::combine<Field<PointType> >
(
gatheredPoints,
accessOp<Field<PointType> >()
);
}
}
// Collect faces from all processors and renumber using sizes of
// gathered points
{
List<List<Face> > gatheredFaces(Pstream::nProcs());
gatheredFaces[Pstream::myProcNo()] = p.localFaces();
Pstream::gatherList(gatheredFaces);
if (Pstream::master())
{
mergedFaces = static_cast<const List<Face>&>
(
ListListOps::combineOffset<List<Face> >
(
gatheredFaces,
pointSizes,
accessOp<List<Face> >(),
offsetOp<Face>()
)
);
}
}
if (Pstream::master())
{
Field<PointType> newPoints;
labelList oldToNew;
bool hasMerged = mergePoints
(
mergedPoints,
mergeDist,
false, // verbosity
oldToNew,
newPoints
);
if (hasMerged)
{
// Store point mapping
pointMergeMap.transfer(oldToNew);
// Copy points
mergedPoints.transfer(newPoints);
// Relabel faces
List<Face>& faces = mergedFaces;
forAll(faces, faceI)
{
inplaceRenumber(pointMergeMap, faces[faceI]);
}
}
}
}
// ************************************************************************* //

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -21,9 +21,6 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Calculation of shape function product for a tetrahedron
\*---------------------------------------------------------------------------*/
#include "tetrahedron.H"
@ -32,6 +29,96 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Point, class PointRef>
void Foam::tetrahedron<Point, PointRef>::tetOverlap
(
const tetrahedron<Point, PointRef>& tetB,
tetIntersectionList& insideTets,
label& nInside,
tetIntersectionList& outsideTets,
label& nOutside
) const
{
// Work storage
tetIntersectionList cutInsideTets;
label nCutInside = 0;
nInside = 0;
storeOp inside(insideTets, nInside);
storeOp cutInside(cutInsideTets, nCutInside);
nOutside = 0;
storeOp outside(outsideTets, nOutside);
// Cut tetA with all inwards pointing faces of tetB. Any tets remaining
// in aboveTets are inside tetB.
{
// face0
plane pl0(tetB.b_, tetB.d_, tetB.c_);
// Cut and insert subtets into cutInsideTets (either by getting
// an index from freeSlots or by appending to insideTets) or
// insert into outsideTets
sliceWithPlane(pl0, cutInside, outside);
}
if (nCutInside == 0)
{
nInside = nCutInside;
return;
}
{
// face1
plane pl1(tetB.a_, tetB.c_, tetB.d_);
nInside = 0;
for (label i = 0; i < nCutInside; i++)
{
cutInsideTets[i].tet().sliceWithPlane(pl1, inside, outside);
}
if (nInside == 0)
{
return;
}
}
{
// face2
plane pl2(tetB.a_, tetB.d_, tetB.b_);
nCutInside = 0;
for (label i = 0; i < nInside; i++)
{
insideTets[i].tet().sliceWithPlane(pl2, cutInside, outside);
}
if (nCutInside == 0)
{
nInside = nCutInside;
return;
}
}
{
// face3
plane pl3(tetB.a_, tetB.b_, tetB.c_);
nInside = 0;
for (label i = 0; i < nCutInside; i++)
{
cutInsideTets[i].tet().sliceWithPlane(pl3, inside, outside);
}
}
}
// (Probably very inefficient) minimum containment sphere calculation.
// From http://www.imr.sandia.gov/papers/imr11/shewchuk2.pdf:
// Sphere ctr is smallest one of

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -87,6 +87,13 @@ class tetrahedron
{
public:
// Public typedefs
//- Storage type for tets originating from intersecting tets.
// (can possibly be smaller than 200)
typedef FixedList<tetPoints, 200> tetIntersectionList;
// Classes for use in sliceWithPlane. What to do with decomposition
// of tet.
@ -111,11 +118,11 @@ public:
//- Store resulting tets
class storeOp
{
FixedList<tetPoints, 200>& tets_;
tetIntersectionList& tets_;
label& nTets_;
public:
inline storeOp(FixedList<tetPoints, 200>&, label&);
inline storeOp(tetIntersectionList&, label&);
inline void operator()(const tetPoints&);
};
@ -261,6 +268,16 @@ public:
BelowTetOp& belowOp
) const;
//- Decompose tet into tets inside and outside other tet
inline void tetOverlap
(
const tetrahedron<Point, PointRef>& tetB,
tetIntersectionList& insideTets,
label& nInside,
tetIntersectionList& outsideTets,
label& nOutside
) const;
//- Return (min)containment sphere, i.e. the smallest sphere with
// all points inside. Returns pointHit with:

View File

@ -556,7 +556,7 @@ inline void Foam::tetrahedron<Point, PointRef>::sumVolOp::operator()
template<class Point, class PointRef>
inline Foam::tetrahedron<Point, PointRef>::storeOp::storeOp
(
FixedList<tetPoints, 200>& tets,
tetIntersectionList& tets,
label& nTets
)
:

View File

@ -41,40 +41,6 @@ License
# define MPI_SCALAR MPI_DOUBLE
#endif
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
typedef struct
{
scalar value;
label count;
} CountAndValue;
void reduceSum
(
void *in,
void *inOut,
int *len,
MPI_Datatype *dptr
)
{
CountAndValue* inPtr =
reinterpret_cast<CountAndValue*>(in);
CountAndValue* inOutPtr =
reinterpret_cast<CountAndValue*>(inOut);
for (int i=0; i< *len; ++i)
{
inOutPtr->value += inPtr->value;
inOutPtr->count += inPtr->count;
inPtr++;
inOutPtr++;
}
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// NOTE:
@ -493,101 +459,11 @@ void Foam::sumReduce
const int tag
)
{
static bool hasDataType_ = false;
static MPI_Datatype mesg_mpi_strct_;
static MPI_Op myOp_;
vector2D twoScalars(Value, scalar(Count));
reduce(twoScalars, sumOp<vector2D>());
if (Pstream::debug)
{
Pout<< "Foam::sumReduce : value:" << Value
<< " count:" << Count << endl;
}
if (!UPstream::parRun())
{
return;
}
if (UPstream::nProcs() <= UPstream::nProcsSimpleSum)
{
reduce(Value, sumOp<scalar>(), tag);
reduce(Count, sumOp<label>(), tag);
}
else
{
CountAndValue in,out;
if (!hasDataType_)
{
int lengths[2];
lengths[0] = 1;
lengths[1] = 1;
MPI_Datatype types[2];
types[0] = MPI_DOUBLE;
types[1] = MPI_INT;
MPI_Aint addresses[2];
MPI_Address(&in.value, &addresses[0]);
MPI_Address(&in.count, &addresses[1]);
MPI_Aint offsets[2];
offsets[0] = 0;
offsets[1] = addresses[1]-addresses[0];
if
(
MPI_Type_create_struct
(
2,
lengths,
offsets,
types,
&mesg_mpi_strct_
)
)
{
FatalErrorIn("Foam::sumReduce()")
<< "MPI_Type_create_struct" << abort(FatalError);
}
if (MPI_Type_commit(&mesg_mpi_strct_))
{
FatalErrorIn("Foam::sumReduce()")
<< "MPI_Type_commit" << abort(FatalError);
}
if (MPI_Op_create(reduceSum, true, &myOp_))
{
FatalErrorIn("Foam::sumReduce()")
<< "MPI_Op_create" << abort(FatalError);
}
hasDataType_ = true;
}
in.value = Value;
in.count = Count;
if
(
MPI_Allreduce
(
&in,
&out,
1,
mesg_mpi_strct_,
myOp_,
MPI_COMM_WORLD
)
)
{
FatalErrorIn("Foam::sumReduce(..)")
<< "Problem." << abort(FatalError);
}
Value = out.value;
Count = out.count;
}
if (Pstream::debug)
{
Pout<< "Foam::reduce : reduced value:" << Value
<< " reduced count:" << Count << endl;
}
Value = twoScalars.x();
Count = twoScalars.y();
}

View File

@ -903,7 +903,9 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints
testSyncPositions(newPoints, 1E-6*mesh_.bounds().mag());
}
tmp<scalarField> tsweptVol = mesh_.movePoints(newPoints);
// Move actual mesh points. Make sure to delete tetBasePtIs so it
// gets rebuilt.
tmp<scalarField> tsweptVol = mesh_.movePoints(newPoints, true);
pp_.movePoints(mesh_.points());

View File

@ -36,14 +36,18 @@ defineTypeNameAndDebug(Foam::vtkUnstructuredReader, 0);
template<>
const char*
Foam::NamedEnum<Foam::vtkUnstructuredReader::vtkDataType, 4>::names[] =
Foam::NamedEnum<Foam::vtkUnstructuredReader::vtkDataType, 8>::names[] =
{
"int",
"unsigned_int",
"long",
"unsigned_long",
"float",
"double",
"string",
"vtkIdType"
};
const Foam::NamedEnum<Foam::vtkUnstructuredReader::vtkDataType, 4>
const Foam::NamedEnum<Foam::vtkUnstructuredReader::vtkDataType, 8>
Foam::vtkUnstructuredReader::vtkDataTypeNames;
@ -385,6 +389,9 @@ void Foam::vtkUnstructuredReader::readField
switch (vtkDataTypeNames[dataType])
{
case VTK_INT:
case VTK_UINT:
case VTK_LONG:
case VTK_ULONG:
case VTK_ID:
{
autoPtr<labelIOField> fieldVals
@ -406,6 +413,7 @@ void Foam::vtkUnstructuredReader::readField
break;
case VTK_FLOAT:
case VTK_DOUBLE:
{
autoPtr<scalarIOField> fieldVals
(
@ -627,7 +635,7 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile)
}
word primitiveTag(inFile);
if (primitiveTag != "float")
if (primitiveTag != "float" && primitiveTag != "double")
{
FatalIOErrorIn("vtkUnstructuredReader::read(..)", inFile)
<< "Expected 'float' entry but found "
@ -809,7 +817,11 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile)
3*wantedSize
);
if (vtkDataTypeNames[dataType] == VTK_FLOAT)
if
(
vtkDataTypeNames[dataType] == VTK_FLOAT
|| vtkDataTypeNames[dataType] == VTK_DOUBLE
)
{
objectRegistry::iterator iter = reg.find(dataName);
scalarField s(*dynamic_cast<const scalarField*>(iter()));

View File

@ -28,6 +28,8 @@ Description
Reader for vtk unstructured_grid legacy files. Supports single CELLS, POINTS
etc. entry only.
- all integer types (int, unsigned_int, long etc.) become Foam::label
- all real types (float, double) become Foam::scalar
- POINTS becomes OpenFOAM points
- CELLS gets split into OpenFOAM
- cells
@ -69,12 +71,16 @@ public:
enum vtkDataType
{
VTK_INT,
VTK_UINT,
VTK_LONG,
VTK_ULONG,
VTK_FLOAT,
VTK_DOUBLE,
VTK_STRING,
VTK_ID
};
static const NamedEnum<vtkDataType, 4> vtkDataTypeNames;
static const NamedEnum<vtkDataType, 8> vtkDataTypeNames;
//- Enumeration defining the vtk dataset types

View File

@ -173,6 +173,8 @@ $(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatch
$(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C
$(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C
$(derivedFvPatchFields)/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C
$(derivedFvPatchFields)/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C
$(derivedFvPatchFields)/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C
fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
@ -338,10 +340,6 @@ $(snGradSchemes)/correctedSnGrad/correctedSnGrads.C
$(snGradSchemes)/limitedSnGrad/limitedSnGrads.C
$(snGradSchemes)/uncorrectedSnGrad/uncorrectedSnGrads.C
$(snGradSchemes)/orthogonalSnGrad/orthogonalSnGrads.C
/*
$(snGradSchemes)/quadraticFitSnGrad/quadraticFitSnGradData.C
$(snGradSchemes)/quadraticFitSnGrad/quadraticFitSnGrads.C
*/
convectionSchemes = finiteVolume/convectionSchemes
$(convectionSchemes)/convectionScheme/convectionSchemes.C

View File

@ -32,6 +32,7 @@ License
#include "faceSet.H"
#include "geometricOneField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::MRFZone, 0);
@ -273,8 +274,8 @@ Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is)
}
}
bool cellZoneFound = (cellZoneID_ != -1);
reduce(cellZoneFound, orOp<bool>());
if (!cellZoneFound)
@ -307,6 +308,7 @@ void Foam::MRFZone::addCoriolis
const scalarField& V = mesh_.V();
vectorField& ddtUc = ddtU.internalField();
const vectorField& Uc = U.internalField();
const vector& Omega = Omega_.value();
forAll(cells, i)
@ -328,6 +330,7 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
const scalarField& V = mesh_.V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
const vector& Omega = Omega_.value();
forAll(cells, i)
@ -353,6 +356,7 @@ void Foam::MRFZone::addCoriolis
const scalarField& V = mesh_.V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
const vector& Omega = Omega_.value();
forAll(cells, i)
@ -368,6 +372,7 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
const volVectorField& C = mesh_.C();
const vector& origin = origin_.value();
const vector& Omega = Omega_.value();
const labelList& cells = mesh_.cellZones()[cellZoneID_];
@ -395,7 +400,8 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
{
label patchFacei = excludedFaces_[patchi][i];
U.boundaryField()[patchi][patchFacei] -=
(Omega ^ (C.boundaryField()[patchi][patchFacei] - origin));
(Omega
^ (C.boundaryField()[patchi][patchFacei] - origin));
}
}
}
@ -406,6 +412,7 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const
const volVectorField& C = mesh_.C();
const vector& origin = origin_.value();
const vector& Omega = Omega_.value();
const labelList& cells = mesh_.cellZones()[cellZoneID_];
@ -475,6 +482,7 @@ void Foam::MRFZone::absoluteFlux
void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const
{
const vector& origin = origin_.value();
const vector& Omega = Omega_.value();
// Included patches
@ -496,4 +504,24 @@ void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const
}
Foam::Ostream& Foam::operator<<(Ostream& os, const MRFZone& MRF)
{
os << indent << nl;
os.write(MRF.name_) << nl;
os << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("origin") << MRF.origin_ << token::END_STATEMENT << nl;
os.writeKeyword("axis") << MRF.axis_ << token::END_STATEMENT << nl;
os.writeKeyword("omega") << MRF.omega_ << token::END_STATEMENT << nl;
if (MRF.excludedPatchNames_.size())
{
os.writeKeyword("nonRotatingPatches") << MRF.excludedPatchNames_
<< token::END_STATEMENT << nl;
}
os << decrIndent << token::END_BLOCK << nl;
return os;
}
// ************************************************************************* //

View File

@ -48,6 +48,7 @@ SourceFiles
#include "surfaceFieldsFwd.H"
#include "fvMatricesFwd.H"
#include "fvMatrices.H"
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -87,7 +88,7 @@ class MRFZone
const dimensionedVector origin_;
dimensionedVector axis_;
const dimensionedScalar omega_;
dimensionedScalar omega_;
dimensionedVector Omega_;
@ -205,13 +206,11 @@ public:
void correctBoundaryVelocity(volVectorField& U) const;
// Ostream Operator
// IOstream operator
friend Ostream& operator<<(Ostream& os, const MRFZone& MRF);
friend Ostream& operator<<(Ostream& os, const MRFZone&)
{
notImplemented("Ostream& operator<<(Ostream& os, const MRFZone&)");
return os;
}
};

View File

@ -49,8 +49,28 @@ Foam::MRFZones::MRFZones(const fvMesh& mesh)
IOobject::NO_WRITE
),
MRFZone::iNew(mesh)
),
mesh_(mesh)
{
if
(
Pstream::parRun()
&&
(
regIOobject::fileModificationChecking == timeStampMaster
|| regIOobject::fileModificationChecking == inotifyMaster
)
)
{}
{
WarningIn("MRFZones(const fvMesh&)")
<< "The MRFZones are not run time modifiable\n"
<< " using 'timeStampMaster' or 'inotifyMaster'\n"
<< " for the entry fileModificationChecking\n"
<< " in the etc/controlDict.\n"
<< " Use 'timeStamp' instead."
<< endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -161,4 +181,11 @@ void Foam::MRFZones::correctBoundaryVelocity(volVectorField& U) const
}
bool Foam::MRFZones::readData(Istream& is)
{
PtrList<MRFZone>::read(is, MRFZone::iNew(mesh_));
return is.good();
}
// ************************************************************************* //

View File

@ -52,6 +52,11 @@ class MRFZones
:
public IOPtrList<MRFZone>
{
// Private data
//- Reference to mesh
const fvMesh& mesh_;
// Private Member Functions
@ -109,6 +114,13 @@ public:
//- Correct the boundary velocity for the roation of the MRF region
void correctBoundaryVelocity(volVectorField& U) const;
// I-O
//- Read from Istream
virtual bool readData(Istream&);
};

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -148,7 +148,7 @@ void Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs()
// scalar rhor = 1000;
// scalarField alphap1 = max(min(alphap, 1.0), 0.0);
// valueFraction() = alphap1/(alphap1 + rhor*(1.0 - alphap1));
valueFraction() = max(min(alphap, 1.0), 0.0);
valueFraction() = max(min(alphap, scalar(1.0)), scalar(0.0));
refValue() =
pRefValue_

View File

@ -0,0 +1,196 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 "variableHeightFlowRateFvPatchField.H"
#include "fvPatchFieldMapper.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::variableHeightFlowRateFvPatchScalarField
::variableHeightFlowRateFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchField<scalar>(p, iF),
phiName_("phi"),
lowerBound_(0.0),
upperBound_(1.0)
{
this->refValue() = 0.0;
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
Foam::variableHeightFlowRateFvPatchScalarField
::variableHeightFlowRateFvPatchScalarField
(
const variableHeightFlowRateFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mixedFvPatchScalarField(ptf, p, iF, mapper),
phiName_(ptf.phiName_),
lowerBound_(ptf.lowerBound_),
upperBound_(ptf.upperBound_)
{}
Foam::variableHeightFlowRateFvPatchScalarField
::variableHeightFlowRateFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchScalarField(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
lowerBound_(readScalar(dict.lookup("lowerBound"))),
upperBound_(readScalar(dict.lookup("upperBound")))
{
this->refValue() = 0.0;
if (dict.found("value"))
{
fvPatchScalarField::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchScalarField::operator=(this->patchInternalField());
}
this->refGrad() = 0.0;
this->valueFraction() = 0.0;
}
Foam::variableHeightFlowRateFvPatchScalarField
::variableHeightFlowRateFvPatchScalarField
(
const variableHeightFlowRateFvPatchScalarField& ptf
)
:
mixedFvPatchScalarField(ptf),
phiName_(ptf.phiName_),
lowerBound_(ptf.lowerBound_),
upperBound_(ptf.upperBound_)
{}
Foam::variableHeightFlowRateFvPatchScalarField
::variableHeightFlowRateFvPatchScalarField
(
const variableHeightFlowRateFvPatchScalarField& ptf,
const DimensionedField<scalar, volMesh>& iF
)
:
mixedFvPatchScalarField(ptf, iF),
phiName_(ptf.phiName_),
lowerBound_(ptf.lowerBound_),
upperBound_(ptf.upperBound_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::variableHeightFlowRateFvPatchScalarField::updateCoeffs()
{
if (this->updated())
{
return;
}
const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
scalarField alphap = this->patchInternalField();
forAll(phip, i)
{
if (phip[i] < -SMALL)
{
if (alphap[i] < lowerBound_)
{
this->refValue()[i] = 0.0;
}
else if (alphap[i] > upperBound_)
{
this->refValue()[i] = 1.0;
}
else
{
this->refValue()[i] = alphap[i];
}
this->valueFraction()[i] = 1.0;
}
else
{
this->refValue()[i] = 0.0;
this->valueFraction()[i] = 0.0;
}
}
mixedFvPatchScalarField::updateCoeffs();
}
void Foam::variableHeightFlowRateFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
if (phiName_ != "phi")
{
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
}
os.writeKeyword("lowerBound") << lowerBound_ << token::END_STATEMENT << nl;
os.writeKeyword("upperBound") << upperBound_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
variableHeightFlowRateFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,174 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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::variableHeightFlowRateFvPatchScalarField
Description
This boundary condition uses zeroGradient within a specified range of
values for phase fraction alpha. The range is defined within the
boundary condition by the lowerBound and upperBound.
alpha > upperBound: fixedValue with uniform value of upperBound
lowerBound <= alpha <= upperBound: zeroGradient
alpha < lowerBound: fixedValue with uniform value of lowerBound
Example:
\verbatim
inlet
{
type clippedZeroGradient;
lowerBound 0.0;
upperBound 0.9;
value uniform 0;
}
\verbatim
SourceFiles
variableHeightFlowRateFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef variableHeightFlowRateFvPatchScalarField_H
#define variableHeightFlowRateFvPatchScalarField_H
#include "mixedFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class variableHeightFlowRateFvPatchScalar Declaration
\*---------------------------------------------------------------------------*/
class variableHeightFlowRateFvPatchScalarField
:
public mixedFvPatchScalarField
{
protected:
// Protected data
//- Name of flux field
word phiName_;
//- Lower bound for alpha1
scalar lowerBound_;
//- Upper bound for alpha1
scalar upperBound_;
public:
//- Runtime scalar information
TypeName("variableHeightFlowRate");
// Constructors
//- Construct from patch and internal field
variableHeightFlowRateFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
variableHeightFlowRateFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// variableHeightFlowRateFvPatchScalarField onto a new patch
variableHeightFlowRateFvPatchScalarField
(
const variableHeightFlowRateFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
variableHeightFlowRateFvPatchScalarField
(
const variableHeightFlowRateFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchField<scalar> > clone() const
{
return tmp<fvPatchField<scalar> >
(
new variableHeightFlowRateFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
variableHeightFlowRateFvPatchScalarField
(
const variableHeightFlowRateFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<scalar> > clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchField<scalar> >
(
new variableHeightFlowRateFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
// Member operators
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,147 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 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 "variableHeightFlowRateInletVelocityFvPatchVectorField.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::variableHeightFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
flowRate_(0)
{}
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::variableHeightFlowRateInletVelocityFvPatchVectorField
(
const variableHeightFlowRateInletVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
flowRate_(ptf.flowRate_)
{}
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::variableHeightFlowRateInletVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
flowRate_(readScalar(dict.lookup("flowRate")))
{}
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::variableHeightFlowRateInletVelocityFvPatchVectorField
(
const variableHeightFlowRateInletVelocityFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
flowRate_(ptf.flowRate_)
{}
Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::variableHeightFlowRateInletVelocityFvPatchVectorField
(
const variableHeightFlowRateInletVelocityFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(ptf, iF),
flowRate_(ptf.flowRate_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::updateCoeffs()
{
if (updated())
{
return;
}
scalarField alphap =
patch().lookupPatchField<volScalarField, scalar>("alpha1");
alphap = max(alphap, 0.0);
alphap = min(alphap, 1.0);
// a simpler way of doing this would be nice
scalar avgU = -flowRate_/gSum(patch().magSf()*alphap);
vectorField n = patch().nf();
operator==(n*avgU*alphap);
fixedValueFvPatchField<vector>::updateCoeffs();
}
void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
os.writeKeyword("flowRate") << flowRate_
<< token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
variableHeightFlowRateInletVelocityFvPatchVectorField
);
}
// ************************************************************************* //

View File

@ -0,0 +1,189 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 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 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::variableHeightFlowRateInletVelocityFvPatchVectorField
Description
Describes a volumetric/mass flow normal vector boundary condition by its
magnitude as an integral over its area.
The basis of the patch (volumetric or mass) is determined by the
dimensions of the flux, phi.
The current density is used to correct the velocity when applying the
mass basis.
The flow rate is made proportional to the phase fraction alpha at each face
of the patch and alpha is ensured to be bound between 0 and 1.
Example of the boundary condition specification:
\verbatim
inlet
{
type variableHeightFlowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
value uniform (0 0 0); // placeholder
}
\endverbatim
Note
- The value is positive inwards
- May not work correctly for transonic inlets
- Strange behaviour with potentialFoam since the U equation is not solved
SourceFiles
variableHeightFlowRateInletVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef variableHeightFlowRateInletVelocityFvPatchVectorField_H
#define variableHeightFlowRateInletVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class variableHeightFlowRateInletVelocityFvPatch Declaration
\*---------------------------------------------------------------------------*/
class variableHeightFlowRateInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Inlet integral flow rate
scalar flowRate_;
public:
//- Runtime type information
TypeName("variableHeightFlowRateInletVelocity");
// Constructors
//- Construct from patch and internal field
variableHeightFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
variableHeightFlowRateInletVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// variableHeightFlowRateInletVelocityFvPatchVectorField
// onto a new patch
variableHeightFlowRateInletVelocityFvPatchVectorField
(
const variableHeightFlowRateInletVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
variableHeightFlowRateInletVelocityFvPatchVectorField
(
const variableHeightFlowRateInletVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new variableHeightFlowRateInletVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
variableHeightFlowRateInletVelocityFvPatchVectorField
(
const variableHeightFlowRateInletVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new variableHeightFlowRateInletVelocityFvPatchVectorField
(
*this,
iF
)
);
}
// Member functions
// Access
//- Return the flux
scalar flowRate() const
{
return flowRate_;
}
//- Return reference to the flux to allow adjustment
scalar& flowRate()
{
return flowRate_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(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 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -389,6 +389,8 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
tmp<fluxFieldType> phiCorr =
phiAbs.oldTime() - (fvc::interpolate(U.oldTime()) & mesh().Sf());
phiCorr().boundaryField() = pTraits<typename flux<Type>::type>::zero;
return tmp<fluxFieldType>
(
new fluxFieldType
@ -430,7 +432,7 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
&& phiAbs.dimensions() == dimVelocity*dimArea
)
{
return tmp<fluxFieldType>
tmp<fluxFieldType> ddtPhiCorr
(
new fluxFieldType
(
@ -446,6 +448,10 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
)
)
);
ddtPhiCorr().boundaryField() = pTraits<typename flux<Type>::type>::zero;
return ddtPhiCorr;
}
else if
(
@ -453,7 +459,7 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
&& phiAbs.dimensions() == rho.dimensions()*dimVelocity*dimArea
)
{
return tmp<fluxFieldType>
tmp<fluxFieldType> ddtPhiCorr
(
new fluxFieldType
(
@ -476,6 +482,10 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
)
)
);
ddtPhiCorr().boundaryField() = pTraits<typename flux<Type>::type>::zero;
return ddtPhiCorr;
}
else if
(
@ -483,7 +493,7 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
&& phiAbs.dimensions() == rho.dimensions()*dimVelocity*dimArea
)
{
return tmp<fluxFieldType>
tmp<fluxFieldType> ddtPhiCorr
(
new fluxFieldType
(
@ -497,6 +507,10 @@ EulerDdtScheme<Type>::fvcDdtPhiCorr
)
)
);
ddtPhiCorr().boundaryField() = pTraits<typename flux<Type>::type>::zero;
return ddtPhiCorr;
}
else
{

View File

@ -1,159 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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
quadraticFitSnGrad
Description
Simple central-difference snGrad scheme with quadratic fit correction from
a larger stencil.
SourceFiles
quadraticFitSnGrad.C
\*---------------------------------------------------------------------------*/
#ifndef quadraticFitSnGrad_H
#define quadraticFitSnGrad_H
#include "snGradScheme.H"
#include "quadraticFitSnGradData.H"
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
/*---------------------------------------------------------------------------*\
Class quadraticFitSnGrad Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class quadraticFitSnGrad
:
public snGradScheme<Type>
{
// Private Data
//- weights for central stencil
const scalar centralWeight_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const quadraticFitSnGrad&);
public:
//- Runtime type information
TypeName("quadraticFit");
// Constructors
//- Construct from mesh and scheme data
quadraticFitSnGrad
(
const fvMesh& mesh,
const scalar centralWeight
)
:
snGradScheme<Type>(mesh),
centralWeight_(centralWeight)
{}
//- Construct from mesh and data stream
quadraticFitSnGrad(const fvMesh& mesh, Istream& is)
:
snGradScheme<Type>(mesh),
centralWeight_(readScalar(is))
{}
//- Destructor
virtual ~quadraticFitSnGrad() {}
// Member Functions
//- Return the interpolation weighting factors for the given field
virtual tmp<surfaceScalarField> deltaCoeffs
(
const GeometricField<Type, fvPatchField, volMesh>&
) const
{
return this->mesh().nonOrthDeltaCoeffs();
}
//- Return true if this scheme uses an explicit correction
virtual bool corrected() const
{
return true;
}
//- Return the explicit correction to the quadraticFitSnGrad
// for the given field
virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
correction(const GeometricField<Type, fvPatchField, volMesh>& vf) const
{
const fvMesh& mesh = this->mesh();
const quadraticFitSnGradData& qfd = quadraticFitSnGradData::New
(
mesh,
centralWeight_
);
const extendedCellToFaceStencil& stencil = qfd.stencil();
const List<scalarList>& f = qfd.fit();
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > sft
= stencil.weightedSum(vf, f);
sft().dimensions() /= dimLength;
return sft;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,321 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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 "quadraticFitSnGradData.H"
#include "surfaceFields.H"
#include "volFields.H"
#include "SVD.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::quadraticFitSnGradData, 0);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::quadraticFitSnGradData::quadraticFitSnGradData
(
const fvMesh& mesh,
const scalar cWeight
)
:
MeshObject<fvMesh, quadraticFitSnGradData>(mesh),
centralWeight_(cWeight),
#ifdef SPHERICAL_GEOMETRY
dim_(2),
#else
dim_(mesh.nGeometricD()),
#endif
minSize_
(
dim_ == 1 ? 3 :
dim_ == 2 ? 6 :
dim_ == 3 ? 9 : 0
),
stencil_(mesh),
fit_(mesh.nInternalFaces())
{
if (debug)
{
Info<< "Contructing quadraticFitSnGradData" << endl;
}
// check input
if (centralWeight_ < 1 - SMALL)
{
FatalErrorIn("quadraticFitSnGradData::quadraticFitSnGradData")
<< "centralWeight requested = " << centralWeight_
<< " should not be less than one"
<< exit(FatalError);
}
if (minSize_ == 0)
{
FatalErrorIn("quadraticFitSnGradData")
<< " dimension must be 1,2 or 3, not" << dim_ << exit(FatalError);
}
// store the polynomial size for each face to write out
surfaceScalarField snGradPolySize
(
IOobject
(
"quadraticFitSnGradPolySize",
"constant",
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("quadraticFitSnGradPolySize", dimless, scalar(0))
);
// Get the cell/face centres in stencil order.
// Centred face stencils no good for triangles of tets. Need bigger stencils
List<List<point> > stencilPoints(stencil_.stencil().size());
stencil_.collectData
(
mesh.C(),
stencilPoints
);
// find the fit coefficients for every face in the mesh
for (label faci = 0; faci < mesh.nInternalFaces(); faci++)
{
snGradPolySize[faci] = calcFit(stencilPoints[faci], faci);
}
if (debug)
{
snGradPolySize.write();
Info<< "quadraticFitSnGradData::quadraticFitSnGradData() :"
<< "Finished constructing polynomialFit data"
<< endl;
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::quadraticFitSnGradData::findFaceDirs
(
vector& idir, // value changed in return
vector& jdir, // value changed in return
vector& kdir, // value changed in return
const fvMesh& mesh,
const label faci
)
{
idir = mesh.Sf()[faci];
idir /= mag(idir);
#ifndef SPHERICAL_GEOMETRY
if (mesh.nGeometricD() <= 2) // find the normal direcion
{
if (mesh.geometricD()[0] == -1)
{
kdir = vector(1, 0, 0);
}
else if (mesh.geometricD()[1] == -1)
{
kdir = vector(0, 1, 0);
}
else
{
kdir = vector(0, 0, 1);
}
}
else // 3D so find a direction in the plane of the face
{
const face& f = mesh.faces()[faci];
kdir = mesh.points()[f[0]] - mesh.points()[f[1]];
}
#else
// Spherical geometry so kdir is the radial direction
kdir = mesh.Cf()[faci];
#endif
if (mesh.nGeometricD() == 3)
{
// Remove the idir component from kdir and normalise
kdir -= (idir & kdir)*idir;
scalar magk = mag(kdir);
if (magk < SMALL)
{
FatalErrorIn("findFaceDirs") << " calculated kdir = zero"
<< exit(FatalError);
}
else
{
kdir /= magk;
}
}
jdir = kdir ^ idir;
}
Foam::label Foam::quadraticFitSnGradData::calcFit
(
const List<point>& C,
const label faci
)
{
vector idir(1,0,0);
vector jdir(0,1,0);
vector kdir(0,0,1);
findFaceDirs(idir, jdir, kdir, mesh(), faci);
scalarList wts(C.size(), scalar(1));
wts[0] = centralWeight_;
wts[1] = centralWeight_;
point p0 = mesh().faceCentres()[faci];
scalar scale = 0;
// calculate the matrix of the polynomial components
scalarRectangularMatrix B(C.size(), minSize_, scalar(0));
forAll(C, ip)
{
const point& p = C[ip];
scalar px = (p - p0)&idir;
scalar py = (p - p0)&jdir;
#ifdef SPHERICAL_GEOMETRY
scalar pz = mag(p) - mag(p0);
#else
scalar pz = (p - p0)&kdir;
#endif
if (ip == 0) scale = max(max(mag(px), mag(py)), mag(pz));
px /= scale;
py /= scale;
pz /= scale;
label is = 0;
B[ip][is++] = wts[0]*wts[ip];
B[ip][is++] = wts[0]*wts[ip]*px;
B[ip][is++] = wts[ip]*sqr(px);
if (dim_ >= 2)
{
B[ip][is++] = wts[ip]*py;
B[ip][is++] = wts[ip]*px*py;
B[ip][is++] = wts[ip]*sqr(py);
}
if (dim_ == 3)
{
B[ip][is++] = wts[ip]*pz;
B[ip][is++] = wts[ip]*px*pz;
//B[ip][is++] = wts[ip]*py*pz;
B[ip][is++] = wts[ip]*sqr(pz);
}
}
// Set the fit
label stencilSize = C.size();
fit_[faci].setSize(stencilSize);
scalarList singVals(minSize_);
label nSVDzeros = 0;
const scalar deltaCoeff = deltaCoeffs()[faci];
bool goodFit = false;
for (int iIt = 0; iIt < 10 && !goodFit; iIt++)
{
SVD svd(B, SMALL);
scalar fit0 = wts[0]*wts[0]*svd.VSinvUt()[1][0]/scale;
scalar fit1 = wts[0]*wts[1]*svd.VSinvUt()[1][1]/scale;
goodFit =
fit0 < 0 && fit1 > 0
&& mag(fit0 + deltaCoeff) < 0.5*deltaCoeff
&& mag(fit1 - deltaCoeff) < 0.5*deltaCoeff;
if (goodFit)
{
fit_[faci][0] = fit0;
fit_[faci][1] = fit1;
for (label i = 2; i < stencilSize; i++)
{
fit_[faci][i] = wts[0]*wts[i]*svd.VSinvUt()[1][i]/scale;
}
singVals = svd.S();
nSVDzeros = svd.nZeros();
}
else // (not good fit so increase weight in the centre and for linear)
{
wts[0] *= 10;
wts[1] *= 10;
for (label i = 0; i < B.n(); i++)
{
B[i][0] *= 10;
B[i][1] *= 10;
}
for (label j = 0; j < B.m(); j++)
{
B[0][j] *= 10;
B[1][j] *= 10;
}
}
}
if (goodFit)
{
// remove the uncorrected snGradScheme coefficients
fit_[faci][0] += deltaCoeff;
fit_[faci][1] -= deltaCoeff;
}
else
{
Pout<< "quadratifFitSnGradData could not fit face " << faci
<< " fit_[faci][0] = " << fit_[faci][0]
<< " fit_[faci][1] = " << fit_[faci][1]
<< " deltaCoeff = " << deltaCoeff << endl;
fit_[faci] = 0;
}
return minSize_ - nSVDzeros;
}
bool Foam::quadraticFitSnGradData::movePoints()
{
notImplemented("quadraticFitSnGradData::movePoints()");
return true;
}
// ************************************************************************* //

View File

@ -1,129 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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
quadraticFitSnGradData
Description
Data for the quadratic fit correction snGrad scheme
SourceFiles
quadraticFitSnGradData.C
\*---------------------------------------------------------------------------*/
#ifndef quadraticFitSnGradData_H
#define quadraticFitSnGradData_H
#include "MeshObject.H"
#include "fvMesh.H"
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class quadraticFitSnGradData Declaration
\*---------------------------------------------------------------------------*/
class quadraticFitSnGradData
:
public MeshObject<fvMesh, quadraticFitSnGradData>
{
// Private data
const scalar centralWeight_;
const label dim_;
//- minimum stencil size
const label minSize_;
//- Extended stencil addressing
extendedCellToFaceStencil stencil_;
//- For each cell in the mesh store the values which multiply the
// values of the stencil to obtain the gradient for each direction
List<scalarList> fit_;
// Private Member Functions
//- Find the normal direction and i, j and k directions for face faci
static void findFaceDirs
(
vector& idir, // value changed in return
vector& jdir, // value changed in return
vector& kdir, // value changed in return
const fvMesh& mesh,
const label faci
);
label calcFit(const List<point>&, const label faci);
public:
TypeName("quadraticFitSnGradData");
// Constructors
explicit quadraticFitSnGradData
(
const fvMesh& mesh,
const scalar cWeight
);
//- Destructor
virtual ~quadraticFitSnGradData()
{};
// Member functions
//- Return reference to the stencil
const extendedCellToFaceStencil& stencil() const
{
return stencil_;
}
//- Return reference to fit coefficients
const List<scalarList>& fit() const { return fit_; }
//- Delete the data when the mesh moves not implemented
virtual bool movePoints();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,43 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 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/>.
Description
Simple central-difference snGrad scheme with quadratic fit correction from
a larger stencil.
\*---------------------------------------------------------------------------*/
#include "quadraticFitSnGrad.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
makeSnGradScheme(quadraticFitSnGrad)
}
}
// ************************************************************************* //

View File

@ -576,12 +576,18 @@ void Foam::fvMatrix<Type>::relax(const scalar alpha)
// Also add the source contribution from the relaxation
forAll(pa, face)
{
Type iCoeff0 = iCoeffs[face];
iCoeffs[face] = cmptMag(iCoeffs[face]);
sumOff[pa[face]] -= cmptMin(iCoeffs[face]);
iCoeffs[face] /= alpha;
S[pa[face]] +=
cmptMultiply(iCoeffs[face] - iCoeff0, psi_[pa[face]]);
// Type iCoeff0 = iCoeffs[face];
// iCoeffs[face] = cmptMag(iCoeffs[face]);
// sumOff[pa[face]] -= cmptMin(iCoeffs[face]);
// iCoeffs[face] /= alpha;
D[pa[face]] +=
cmptMag(cmptMin(iCoeffs[face]))
- cmptMin(iCoeffs[face]);
sumOff[pa[face]] +=
cmptMag(cmptMin(iCoeffs[face]))
- cmptMin(iCoeffs[face]);
// S[pa[face]] +=
// cmptMultiply(iCoeffs[face] - iCoeff0, psi_[pa[face]]);
}
}
}

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,6 +32,7 @@ License
#include "surfaceInterpolate.H"
#include "fvcSurfaceIntegrate.H"
#include "slicedSurfaceFields.H"
#include "wedgeFvPatch.H"
#include "syncTools.H"
#include "fvm.H"
@ -567,19 +568,29 @@ void Foam::MULES::limiter
fvsPatchScalarField& lambdaPf = lambdaBf[patchi];
const scalarField& phiCorrfPf = phiCorrBf[patchi];
const labelList& pFaceCells = mesh.boundary()[patchi].faceCells();
forAll(lambdaPf, pFacei)
if (isA<wedgeFvPatch>(mesh.boundary()[patchi]))
{
label pfCelli = pFaceCells[pFacei];
lambdaPf = 0;
}
else
{
const labelList& pFaceCells =
mesh.boundary()[patchi].faceCells();
if (phiCorrfPf[pFacei] > 0.0)
forAll(lambdaPf, pFacei)
{
lambdaPf[pFacei] = min(lambdaPf[pFacei], lambdap[pfCelli]);
}
else
{
lambdaPf[pFacei] = min(lambdaPf[pFacei], lambdam[pfCelli]);
label pfCelli = pFaceCells[pFacei];
if (phiCorrfPf[pFacei] > 0.0)
{
lambdaPf[pFacei] =
min(lambdaPf[pFacei], lambdap[pfCelli]);
}
else
{
lambdaPf[pFacei] =
min(lambdaPf[pFacei], lambdam[pfCelli]);
}
}
}
}

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,6 +40,7 @@ Description
#include "snapParameters.H"
#include "refinementSurfaces.H"
#include "unitConversion.H"
#include "localPointRegion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1267,6 +1268,121 @@ void Foam::autoSnapDriver::doSnap
meshRefiner_.createZoneBaffles(globalToPatch_, baffles);
// Selectively 'forget' about the baffles, i.e. not check across them
// or merge across them.
{
const faceZoneMesh& fZones = mesh.faceZones();
const refinementSurfaces& surfaces = meshRefiner_.surfaces();
const wordList& faceZoneNames = surfaces.faceZoneNames();
const List<refinementSurfaces::faceZoneType>& faceType =
surfaces.faceType();
// Determine which
// - faces to remove from list of baffles (so not merge)
// - points to duplicate
labelList filterFace(mesh.nFaces(), -1);
label nFilterFaces = 0;
PackedBoolList duplicatePoint(mesh.nPoints());
label nDuplicatePoints = 0;
forAll(faceZoneNames, surfI)
{
if
(
faceType[surfI] == refinementSurfaces::BAFFLE
|| faceType[surfI] == refinementSurfaces::BOUNDARY
)
{
if (faceZoneNames[surfI].size())
{
// Filter out all faces for this zone.
label zoneI = fZones.findZoneID(faceZoneNames[surfI]);
const faceZone& fZone = fZones[zoneI];
forAll(fZone, i)
{
label faceI = fZone[i];
filterFace[faceI] = zoneI;
nFilterFaces++;
}
if (faceType[surfI] == refinementSurfaces::BOUNDARY)
{
forAll(fZone, i)
{
label faceI = fZone[i];
const face& f = mesh.faces()[faceI];
forAll(f, fp)
{
if (!duplicatePoint[f[fp]])
{
duplicatePoint[f[fp]] = 1;
nDuplicatePoints++;
}
}
}
}
Info<< "Surface : " << surfaces.names()[surfI] << nl
<< " faces to become baffle : "
<< returnReduce(nFilterFaces, sumOp<label>()) << nl
<< " points to duplicate : "
<< returnReduce(nDuplicatePoints, sumOp<label>())
<< endl;
}
}
}
// Duplicate points
if (returnReduce(nDuplicatePoints, sumOp<label>()) > 0)
{
// Collect all points
labelList candidatePoints(nDuplicatePoints);
nDuplicatePoints = 0;
forAll(duplicatePoint, pointI)
{
if (duplicatePoint[pointI])
{
candidatePoints[nDuplicatePoints++] = pointI;
}
}
localPointRegion regionSide(mesh, candidatePoints);
autoPtr<mapPolyMesh> mapPtr = meshRefiner_.dupNonManifoldPoints
(
regionSide
);
meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace);
}
// Forget about baffles in a BAFFLE/BOUNDARY type zone
DynamicList<labelPair> newBaffles(baffles.size());
forAll(baffles, i)
{
const labelPair& baffle = baffles[i];
if
(
filterFace[baffle.first()] == -1
&& filterFace[baffles[i].second()] == -1
)
{
newBaffles.append(baffle);
}
}
if (newBaffles.size() < baffles.size())
{
//Info<< "Splitting baffles into" << nl
// << " internal : " << newBaffles.size() << nl
// << " baffle : " << baffles.size()-newBaffles.size()
// << nl << endl;
baffles.transfer(newBaffles);
}
Info<< endl;
}
bool doFeatures = false;
label nFeatIter = 1;
if (snapParams.nFeatureSnap() > 0)

View File

@ -2216,28 +2216,6 @@ void Foam::meshRefinement::dumpRefinementLevel() const
pointRefLevel.write();
}
// Dump cell centres
{
for (direction i=0; i<vector::nComponents; i++)
{
volScalarField cci
(
IOobject
(
"cc" + word(vector::componentNames[i]),
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_.C().component(i)
);
cci.write();
}
}
}

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,6 +70,7 @@ class searchableSurface;
class regionSplit;
class globalIndex;
class removePoints;
class localPointRegion;
/*---------------------------------------------------------------------------*\
Class meshRefinement Declaration
@ -141,15 +142,6 @@ private:
// Private Member Functions
//- Reorder list according to map.
template<class T>
static void updateList
(
const labelList& newToOld,
const T& nullValue,
List<T>& elems
);
//- Add patchfield of given type to all fields on mesh
template<class GeoField>
static void addPatchFields(fvMesh&, const word& patchFieldType);
@ -707,6 +699,10 @@ public:
const point& keepPoint
);
//- Find boundary points that connect to more than one cell
// region and split them.
autoPtr<mapPolyMesh> dupNonManifoldPoints(const localPointRegion&);
//- Find boundary points that connect to more than one cell
// region and split them.
autoPtr<mapPolyMesh> dupNonManifoldPoints();
@ -780,6 +776,15 @@ public:
const labelList& changedFaces
);
//- Helper: reorder list according to map.
template<class T>
static void updateList
(
const labelList& newToOld,
const T& nullValue,
List<T>& elems
);
// Restoring : is where other processes delete and reinsert data.

View File

@ -2206,15 +2206,14 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
// Find boundary points that connect to more than one cell region and
// split them.
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints
(
const localPointRegion& regionSide
)
{
// Topochange container
polyTopoChange meshMod(mesh_);
// Analyse which points need to be duplicated
localPointRegion regionSide(mesh_);
label nNonManifPoints = returnReduce
(
regionSide.meshPointMap().size(),
@ -2260,6 +2259,17 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
}
// Find boundary points that connect to more than one cell region and
// split them.
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
{
// Analyse which points need to be duplicated
localPointRegion regionSide(mesh_);
return dupNonManifoldPoints(regionSide);
}
// Zoning
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
(

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,12 +49,28 @@ namespace Foam
"none"
};
}
const Foam::NamedEnum<Foam::refinementSurfaces::areaSelectionAlgo, 4>
Foam::refinementSurfaces::areaSelectionAlgoNames;
namespace Foam
{
template<>
const char* Foam::NamedEnum
<
Foam::refinementSurfaces::faceZoneType,
3
>::names[] =
{
"internal",
"baffle",
"boundary"
};
}
const Foam::NamedEnum<Foam::refinementSurfaces::faceZoneType, 3>
Foam::refinementSurfaces::faceZoneTypeNames;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::refinementSurfaces::refinementSurfaces
@ -70,6 +86,7 @@ Foam::refinementSurfaces::refinementSurfaces
cellZoneNames_(surfacesDict.size()),
zoneInside_(surfacesDict.size(), NONE),
zoneInsidePoints_(surfacesDict.size()),
faceType_(surfacesDict.size(), INTERNAL),
regionOffset_(surfacesDict.size())
{
// Wilcard specification : loop over all surface, all regions
@ -93,6 +110,7 @@ Foam::refinementSurfaces::refinementSurfaces
faceZoneNames_.setSize(surfI);
cellZoneNames_.setSize(surfI);
zoneInside_.setSize(surfI, NONE);
faceType_.setSize(surfI, INTERNAL),
regionOffset_.setSize(surfI);
labelList globalMinLevel(surfI, 0);
@ -183,8 +201,17 @@ Foam::refinementSurfaces::refinementSurfaces
<< " since no cellZone specified."
<< endl;
}
// How to handle faces on faceZone
word faceTypeMethod;
if (dict.readIfPresent("faceType", faceTypeMethod))
{
faceType_[surfI] = faceZoneTypeNames[faceTypeMethod];
}
}
// Global perpendicular angle
if (dict.found("patchInfo"))
{

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,6 +70,16 @@ public:
static const NamedEnum<areaSelectionAlgo, 4> areaSelectionAlgoNames;
//- What to do with faceZone faces
enum faceZoneType
{
INTERNAL,
BAFFLE,
BOUNDARY
};
static const NamedEnum<faceZoneType, 3> faceZoneTypeNames;
private:
// Private data
@ -97,6 +107,10 @@ private:
//- If zoneInside=location gives the corresponding inside point
pointField zoneInsidePoints_;
//- Per 'interface' surface :
// Waht to do with outside
List<faceZoneType> faceType_;
//- From local region number to global region number
labelList regionOffset_;
@ -187,6 +201,12 @@ public:
return zoneInsidePoints_;
}
//- How to handle face of surfaces with a faceZone
const List<faceZoneType>& faceType() const
{
return faceType_;
}
//- From local region number to global region number
const labelList& regionOffset() const
{

View File

@ -693,6 +693,7 @@ void Foam::searchableSurfacesQueries::signedDistance
const labelList& surfacesToTest,
const pointField& samples,
const scalarField& nearestDistSqr,
const searchableSurface::volumeType illegalHandling,
labelList& nearestSurfaces,
scalarField& distance
)
@ -753,9 +754,32 @@ void Foam::searchableSurfacesQueries::signedDistance
}
else
{
FatalErrorIn("signedDistance()")
<< "getVolumeType failure, neither INSIDE or OUTSIDE"
<< exit(FatalError);
switch (illegalHandling)
{
case searchableSurface::OUTSIDE:
{
distance[pointI] = dist;
break;
}
case searchableSurface::INSIDE:
{
distance[pointI] = -dist;
break;
}
default:
{
FatalErrorIn("signedDistance()")
<< "getVolumeType failure,"
<< " neither INSIDE or OUTSIDE."
<< " point:" << surfPoints[i]
<< " surface:"
<< allSurfaces[surfacesToTest[testI]].name()
<< " volType:"
<< searchableSurface::volumeTypeNames[vT]
<< exit(FatalError);
break;
}
}
}
}
}

View File

@ -184,13 +184,18 @@ public:
List<pointIndexHit>&
);
//- Find signed distance to nearest surface
//- Find signed distance to nearest surface. Outside is positive.
// illegalHandling: how to handle non-inside or outside
// OUTSIDE : treat as outside
// INSIDE : treat as inside
// UNKNOWN : throw fatal error
static void signedDistance
(
const PtrList<searchableSurface>& allSurfaces,
const labelList& surfacesToTest,
const pointField& samples,
const scalarField& nearestDistSqr,
const searchableSurface::volumeType illegalHandling,
labelList& nearestSurfaces,
scalarField& distance
);

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -118,7 +118,7 @@ void Foam::meshToMesh::calculateInverseVolumeWeights() const
inverseVolumeWeightsPtr_ = new scalarListList(toMesh_.nCells());
scalarListList& invVolCoeffs = *inverseVolumeWeightsPtr_;
labelListList& cellToCell = *cellToCellAddressingPtr_;
const labelListList& cellToCell = cellToCellAddressing();
tetOverlapVolume overlapEngine;
@ -129,8 +129,8 @@ void Foam::meshToMesh::calculateInverseVolumeWeights() const
if (overlapCells.size() > 0)
{
invVolCoeffs[celli].setSize(overlapCells.size());
scalar v(0);
forAll (overlapCells, j)
forAll(overlapCells, j)
{
label cellFrom = overlapCells[j];
treeBoundBox bbFromMesh
@ -142,7 +142,7 @@ void Foam::meshToMesh::calculateInverseVolumeWeights() const
)
);
v = overlapEngine.cellCellOverlapVolumeMinDecomp
scalar v = overlapEngine.cellCellOverlapVolumeMinDecomp
(
toMesh_,
celli,
@ -151,19 +151,14 @@ void Foam::meshToMesh::calculateInverseVolumeWeights() const
cellFrom,
bbFromMesh
);
invVolCoeffs[celli][j] = v/toMesh_.V()[celli];
}
if (celli == 2)
{
Info << "cellToCell :" << cellToCell[celli] << endl;
Info << "invVolCoeffs :" << invVolCoeffs[celli] << endl;
invVolCoeffs[celli][j] = v/toMesh_.V()[celli];
}
}
}
}
void Foam::meshToMesh::calculateCellToCellAddressing() const
void Foam::meshToMesh::calculateCellToCellAddressing() const
{
if (debug)
{

View File

@ -45,102 +45,15 @@ Foam::tetOverlapVolume::tetOverlapVolume()
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
void Foam::tetOverlapVolume::tetTetOverlap
(
const tetPoints& tetA,
const tetPoints& tetB,
FixedList<tetPoints, 200>& insideTets,
label& nInside,
FixedList<tetPoints, 200>& outsideTets,
label& nOutside
) const
{
// Work storage
FixedList<tetPoints, 200> cutInsideTets;
label nCutInside = 0;
tetPointRef::storeOp inside(insideTets, nInside);
tetPointRef::storeOp cutInside(cutInsideTets, nCutInside);
tetPointRef::dummyOp outside;
// Cut tetA with all inwards pointing faces of tetB. Any tets remaining
// in aboveTets are inside tetB.
{
// face0
plane pl0(tetB[1], tetB[3], tetB[2]);
// Cut and insert subtets into cutInsideTets (either by getting
// an index from freeSlots or by appending to insideTets) or
// insert into outsideTets
tetA.tet().sliceWithPlane(pl0, cutInside, outside);
}
if (nCutInside == 0)
{
nInside = nCutInside;
return;
}
{
// face1
plane pl1(tetB[0], tetB[2], tetB[3]);
nInside = 0;
for (label i = 0; i < nCutInside; i++)
{
cutInsideTets[i].tet().sliceWithPlane(pl1, inside, outside);
}
if (nInside == 0)
{
return;
}
}
{
// face2
plane pl2(tetB[0], tetB[3], tetB[1]);
nCutInside = 0;
for (label i = 0; i < nInside; i++)
{
insideTets[i].tet().sliceWithPlane(pl2, cutInside, outside);
}
if (nCutInside == 0)
{
nInside = nCutInside;
return;
}
}
{
// face3
plane pl3(tetB[0], tetB[1], tetB[2]);
nInside = 0;
for (label i = 0; i < nCutInside; i++)
{
cutInsideTets[i].tet().sliceWithPlane(pl3, inside, outside);
}
}
}
Foam::scalar Foam::tetOverlapVolume::tetTetOverlapVol
(
const tetPoints& tetA,
const tetPoints& tetB
) const
{
FixedList<tetPoints, 200> insideTets;
tetPointRef::tetIntersectionList insideTets;
label nInside = 0;
FixedList<tetPoints, 200> cutInsideTets;
tetPointRef::tetIntersectionList cutInsideTets;
label nCutInside = 0;
tetPointRef::storeOp inside(insideTets, nInside);
@ -222,7 +135,7 @@ Foam::scalar Foam::tetOverlapVolume::cellCellOverlapVolumeMinDecomp
const primitiveMesh& meshB,
const label cellBI,
const treeBoundBox& cellBbB
)
) const
{
const cell& cFacesA = meshA.cells()[cellAI];
const point& ccA = meshA.cellCentres()[cellAI];

View File

@ -55,17 +55,6 @@ class tetOverlapVolume
{
// Private member functions
//- Tet overlap
void tetTetOverlap
(
const tetPoints& tetA,
const tetPoints& tetB,
FixedList<tetPoints, 200>& insideTets,
label& nInside,
FixedList<tetPoints, 200>& outsideTets,
label& nOutside
) const;
//- Tet Overlap Vol
scalar tetTetOverlapVol
(
@ -115,7 +104,7 @@ public:
const primitiveMesh& meshB,
const label cellBI,
const treeBoundBox& cellBbB
);
) const;
};

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,9 +28,8 @@ License
#include "dictionary.H"
#include "Time.H"
#include "IOmanip.H"
#include "ListListOps.H"
#include "mergePoints.H"
#include "volPointInterpolation.H"
#include "PatchTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -38,34 +37,6 @@ defineTypeNameAndDebug(Foam::sampledSurfaces, 0);
bool Foam::sampledSurfaces::verbose_ = false;
Foam::scalar Foam::sampledSurfaces::mergeTol_ = 1e-10;
namespace Foam
{
//- Used to offset faces in Pstream::combineOffset
template <>
class offsetOp<face>
{
public:
face operator()
(
const face& x,
const label offset
) const
{
face result(x.size());
forAll(x, xI)
{
result[xI] = x[xI] + offset;
}
return result;
}
};
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::sampledSurfaces::writeGeometry() const
@ -379,80 +350,18 @@ bool Foam::sampledSurfaces::update()
continue;
}
// Collect points from all processors
List<pointField> gatheredPoints(Pstream::nProcs());
gatheredPoints[Pstream::myProcNo()] = s.points();
Pstream::gatherList(gatheredPoints);
if (Pstream::master())
{
mergeList_[surfI].points = ListListOps::combine<pointField>
(
gatheredPoints,
accessOp<pointField>()
);
}
// Collect faces from all processors and renumber using sizes of
// gathered points
List<faceList> gatheredFaces(Pstream::nProcs());
gatheredFaces[Pstream::myProcNo()] = s.faces();
Pstream::gatherList(gatheredFaces);
if (Pstream::master())
{
mergeList_[surfI].faces = static_cast<const faceList&>
(
ListListOps::combineOffset<faceList>
(
gatheredFaces,
ListListOps::subSizes
(
gatheredPoints,
accessOp<pointField>()
),
accessOp<faceList>(),
offsetOp<face>()
)
);
}
pointField newPoints;
labelList oldToNew;
bool hasMerged = mergePoints
PatchTools::gatherAndMerge
(
mergeList_[surfI].points,
mergeDim,
false, // verbosity
oldToNew,
newPoints
primitivePatch
(
SubList<face>(s.faces(), s.faces().size()),
s.points()
),
mergeList_[surfI].points,
mergeList_[surfI].faces,
mergeList_[surfI].pointsMap
);
if (hasMerged)
{
// Store point mapping
mergeList_[surfI].pointsMap.transfer(oldToNew);
// Copy points
mergeList_[surfI].points.transfer(newPoints);
// Relabel faces
faceList& faces = mergeList_[surfI].faces;
forAll(faces, faceI)
{
inplaceRenumber(mergeList_[surfI].pointsMap, faces[faceI]);
}
if (Pstream::master() && debug)
{
Pout<< "For surface " << surfI << " merged from "
<< mergeList_[surfI].pointsMap.size() << " points down to "
<< mergeList_[surfI].points.size() << " points" << endl;
}
}
}
return updated;

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,7 @@ SourceFiles
#define labelledTri_H
#include "triFace.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -115,6 +116,30 @@ template<>
inline bool contiguous<labelledTri>() {return true;}
//- Hash specialization to offset faces in ListListOps::combineOffset
template<>
class offsetOp<labelledTri>
{
public:
inline labelledTri operator()
(
const labelledTri& x,
const label offset
) const
{
labelledTri result(x);
forAll(x, xI)
{
result[xI] = x[xI] + offset;
}
return result;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -351,6 +351,7 @@ void LRR::correct()
(
fvm::ddt(rho_, epsilon_)
+ fvm::div(phi_, epsilon_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), epsilon_)
//- fvm::laplacian(Ceps*rho_*(k_/epsilon_)*R_, epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
==
@ -393,6 +394,7 @@ void LRR::correct()
(
fvm::ddt(rho_, R_)
+ fvm::div(phi_, R_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), R_)
//- fvm::laplacian(Cs*rho_*(k_/epsilon_)*R_, R_)
- fvm::laplacian(DREff(), R_)
+ fvm::Sp(Clrr1_*rho_*epsilon_/k_, R_)

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -389,6 +389,7 @@ void LaunderGibsonRSTM::correct()
(
fvm::ddt(rho_, epsilon_)
+ fvm::div(phi_, epsilon_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), epsilon_)
//- fvm::laplacian(Ceps*rho_*(k_/epsilon_)*R_, epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
==
@ -432,6 +433,7 @@ void LaunderGibsonRSTM::correct()
(
fvm::ddt(rho_, R_)
+ fvm::div(phi_, R_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), R_)
//- fvm::laplacian(Cs*rho_*(k_/epsilon_)*R_, R_)
- fvm::laplacian(DREff(), R_)
+ fvm::Sp(Clg1_*rho_*epsilon_/k_, R_)

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -314,6 +314,7 @@ void LaunderSharmaKE::correct()
(
fvm::ddt(rho_, epsilon_)
+ fvm::div(phi_, epsilon_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
==
C1_*G*epsilon_/k_ + fvm::SuSp((C3_ - 2.0/3.0*C1_)*rho_*divU, epsilon_)
@ -333,6 +334,7 @@ void LaunderSharmaKE::correct()
(
fvm::ddt(rho_, k_)
+ fvm::div(phi_, k_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), k_)
- fvm::laplacian(DkEff(), k_)
==
G - fvm::SuSp(2.0/3.0*rho_*divU, k_)

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -321,6 +321,7 @@ void RNGkEpsilon::correct()
(
fvm::ddt(rho_, epsilon_)
+ fvm::div(phi_, epsilon_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
==
(C1_ - R)*G*epsilon_/k_
@ -342,6 +343,7 @@ void RNGkEpsilon::correct()
(
fvm::ddt(rho_, k_)
+ fvm::div(phi_, k_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), k_)
- fvm::laplacian(DkEff(), k_)
==
G - fvm::SuSp(2.0/3.0*rho_*divU, k_)

View File

@ -416,6 +416,7 @@ void SpalartAllmaras::correct()
(
fvm::ddt(rho_, nuTilda_)
+ fvm::div(phi_, nuTilda_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), nuTilda_)
- fvm::laplacian(DnuTildaEff(), nuTilda_)
- Cb2_/sigmaNut_*rho_*magSqr(fvc::grad(nuTilda_))
==

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -292,6 +292,7 @@ void kEpsilon::correct()
(
fvm::ddt(rho_, epsilon_)
+ fvm::div(phi_, epsilon_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
==
C1_*G*epsilon_/k_
@ -313,6 +314,7 @@ void kEpsilon::correct()
(
fvm::ddt(rho_, k_)
+ fvm::div(phi_, k_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), k_)
- fvm::laplacian(DkEff(), k_)
==
G

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -411,6 +411,7 @@ void kOmegaSST::correct()
(
fvm::ddt(rho_, omega_)
+ fvm::div(phi_, omega_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), omega_)
- fvm::laplacian(DomegaEff(F1), omega_)
==
rhoGammaF1*GbyMu
@ -435,6 +436,7 @@ void kOmegaSST::correct()
(
fvm::ddt(rho_, k_)
+ fvm::div(phi_, k_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), k_)
- fvm::laplacian(DkEff(F1), k_)
==
min(G, (c1_*betaStar_)*rho_*k_*omega_)

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-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -331,6 +331,7 @@ void realizableKE::correct()
(
fvm::ddt(rho_, epsilon_)
+ fvm::div(phi_, epsilon_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_)
==
C1*rho_*magS*epsilon_
@ -355,6 +356,7 @@ void realizableKE::correct()
(
fvm::ddt(rho_, k_)
+ fvm::div(phi_, k_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), k_)
- fvm::laplacian(DkEff(), k_)
==
G - fvm::SuSp(2.0/3.0*rho_*divU, k_)