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

This commit is contained in:
andy
2013-01-09 17:21:01 +00:00
51 changed files with 590 additions and 446 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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,9 +27,6 @@ Class
Description
Simplified diagonal-based incomplete LU smoother for asymmetric matrices.
To improve efficiency, the residual is evaluated after every nSweeps
sweeps.
SourceFiles
DILUSmoother.C

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -367,7 +367,8 @@ public:
);
//- Construct from reverse addressing: per data item the send
// processor and the receive processor. All processors get same data.
// processor and the receive processor. (note: data is not stored
// sorted per processor so cannot use printLayout).
mapDistribute
(
const labelList& sendProcs,
@ -635,7 +636,8 @@ public:
template<class T>
void receive(PstreamBuffers&, List<T>&) const;
//- Debug: print layout
//- Debug: print layout. Can only be used on maps with sorted
// storage (local data first, then non-local data)
void printLayout(Ostream& os) const;
//- Correct for topo change.

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -137,7 +137,7 @@ public:
// be in top patch
// < 0 : face in opposite orientation as patch face. face will
// be in bottom patch
// = 0 : for all side and internal faces
// = 0 : for all side faces
const labelList& faceToFaceMap() const
{
return faceToFaceMap_;

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -56,6 +56,48 @@ reconstruct
const fvMesh& mesh = ssf.mesh();
surfaceVectorField faceVols
(
mesh.Sf()/(mesh.magSf()*mesh.nonOrthDeltaCoeffs())
);
faceVols.internalField() *= (1.0 - mesh.weights().internalField());
forAll(faceVols.boundaryField(), patchi)
{
if (faceVols.boundaryField()[patchi].coupled())
{
faceVols.boundaryField()[patchi] *=
(1.0 - mesh.weights().boundaryField()[patchi]);
}
}
tmp<GeometricField<GradType, fvPatchField, volMesh> > treconField
(
new GeometricField<GradType, fvPatchField, volMesh>
(
IOobject
(
"volIntegrate("+ssf.name()+')',
ssf.instance(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
inv(surfaceSum(mesh.Sf()*faceVols))&surfaceSum(faceVols*ssf),
zeroGradientFvPatchField<GradType>::typeName
)
);
treconField().correctBoundaryConditions();
return treconField;
}
/*
{
typedef typename outerProduct<vector, Type>::type GradType;
const fvMesh& mesh = ssf.mesh();
tmp<GeometricField<GradType, fvPatchField, volMesh> > treconField
(
new GeometricField<GradType, fvPatchField, volMesh>
@ -78,6 +120,7 @@ reconstruct
return treconField;
}
*/
template<class Type>

View File

@ -59,63 +59,8 @@ inline bool Foam::pointEdgePoint::update
if ((diff < SMALL) || ((distSqr_ > SMALL) && (diff/distSqr_ < tol)))
{
// don't propagate small changes unless origins differ
scalar originDiff2 = magSqr(origin_-w2.origin());
if
(
originDiff2 < SMALL
|| ((distSqr_ > SMALL) && (originDiff2/distSqr_ < tol))
)
{
return false;
}
else
{
// Different origin. Choose lexical ordering.
bool w2less = false;
for (direction cmp = 0; cmp < vector::nComponents; cmp++)
{
scalar d = w2.origin()[cmp]-origin_[cmp];
scalar magD = mag(d);
if
(
magD < SMALL
|| ((distSqr_ > SMALL) && (magD/distSqr_ > tol))
)
{
// Small difference. Test next component.
}
else if (d < 0)
{
w2less = true;
break;
}
else if (d > 0)
{
break;
}
}
if (w2less)
{
// update with new values
distSqr_ = dist2;
origin_ = w2.origin();
return true;
}
else
{
Pout<< "** same distance. at:" << pt << nl
<< " old distance:" << Foam::sqr(distSqr_) << nl
<< " new distance:" << Foam::sqr(dist2) << nl
<< " old origin:" << origin_ << nl
<< " new origin:" << w2.origin() << nl
<< endl;
Pout<< "** w2 looses." << endl;
return false;
}
}
// don't propagate small changes
return false;
}
else
{

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,6 +31,7 @@ License
#include "OFstream.H"
#include "Random.H"
#include "treeDataFace.H"
#include "treeDataPoint.H"
#include "indexedOctree.H"
#include "polyMesh.H"
#include "polyPatch.H"
@ -38,6 +39,7 @@ License
#include "mapDistribute.H"
#include "SubField.H"
#include "triPointRef.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,12 +51,13 @@ namespace Foam
const char* Foam::NamedEnum
<
Foam::mappedPatchBase::sampleMode,
4
5
>::names[] =
{
"nearestCell",
"nearestPatchFace",
"nearestPatchFaceAMI",
"nearestPatchPoint",
"nearestFace"
};
@ -72,7 +75,7 @@ namespace Foam
}
const Foam::NamedEnum<Foam::mappedPatchBase::sampleMode, 4>
const Foam::NamedEnum<Foam::mappedPatchBase::sampleMode, 5>
Foam::mappedPatchBase::sampleModeNames_;
const Foam::NamedEnum<Foam::mappedPatchBase::offsetMode, 3>
@ -315,6 +318,77 @@ void Foam::mappedPatchBase::findSamples
break;
}
case NEARESTPATCHPOINT:
{
Random rndGen(123456);
const polyPatch& pp = samplePolyPatch();
if (pp.empty())
{
forAll(samples, sampleI)
{
nearest[sampleI].second().first() = Foam::sqr(GREAT);
nearest[sampleI].second().second() = Pstream::myProcNo();
}
}
else
{
// patch (local) points
treeBoundBox patchBb
(
treeBoundBox(pp.points(), pp.meshPoints()).extend
(
rndGen,
1e-4
)
);
patchBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
patchBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
indexedOctree<treeDataPoint> boundaryTree
(
treeDataPoint // all information needed to search faces
(
mesh.points(),
pp.meshPoints() // selection of points to search on
),
patchBb, // overall search domain
8, // maxLevel
10, // leafsize
3.0 // duplicity
);
forAll(samples, sampleI)
{
const point& sample = samples[sampleI];
pointIndexHit& nearInfo = nearest[sampleI].first();
nearInfo = boundaryTree.findNearest
(
sample,
magSqr(patchBb.span())
);
if (!nearInfo.hit())
{
nearest[sampleI].second().first() = Foam::sqr(GREAT);
nearest[sampleI].second().second() =
Pstream::myProcNo();
}
else
{
const point& pt = nearInfo.hitPoint();
nearest[sampleI].second().first() = magSqr(pt-sample);
nearest[sampleI].second().second() =
Pstream::myProcNo();
}
}
}
break;
}
case NEARESTFACE:
{
if (samplePatch_.size() && samplePatch_ != "none")
@ -373,10 +447,11 @@ void Foam::mappedPatchBase::findSamples
}
// Find nearest
// Find nearest. Combine on master.
Pstream::listCombineGather(nearest, nearestEqOp());
Pstream::listCombineScatter(nearest);
if (debug)
{
Info<< "mappedPatchBase::findSamples on mesh " << sampleRegion_
@ -388,8 +463,9 @@ void Foam::mappedPatchBase::findSamples
Info<< " " << sampleI << " coord:"<< samples[sampleI]
<< " found on processor:" << procI
<< " in local cell/face:" << localI
<< " with cc:" << nearest[sampleI].first().rawPoint() << endl;
<< " in local cell/face/point:" << localI
<< " with location:" << nearest[sampleI].first().rawPoint()
<< endl;
}
}
@ -599,7 +675,8 @@ void Foam::mappedPatchBase::calcMapping() const
+ "_mapped.obj"
);
Pout<< "Dumping mapping as lines from patch faceCentres to"
<< " sampled cell/faceCentres to file " << str.name() << endl;
<< " sampled cell/faceCentres/points to file " << str.name()
<< endl;
label vertI = 0;

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,6 +39,10 @@ Description
- patches need not conform
- uses AMI interpolation
// - nearestFace : nearest boundary face on any patch
// - nearestPatchPoint : nearest patch point (for coupled points
// this might be any of the points so you have
// to guarantee the point data is synchronised
// beforehand)
sampleMode nearestCell;
// If sampleMod is nearestPatchFace : patch to find faces of
@ -99,8 +103,9 @@ public:
enum sampleMode
{
NEARESTCELL, // nearest cell
NEARESTPATCHFACE, // faces on selected patch
NEARESTPATCHFACE, // nearest face on selected patch
NEARESTPATCHFACEAMI, // nearest patch face + AMI interpolation
NEARESTPATCHPOINT, // nearest point on selected patch
NEARESTFACE // nearest face
};
@ -112,7 +117,7 @@ public:
NORMAL // use face normal + distance
};
static const NamedEnum<sampleMode, 4> sampleModeNames_;
static const NamedEnum<sampleMode, 5> sampleModeNames_;
static const NamedEnum<offsetMode, 3> offsetModeNames_;
@ -145,6 +150,27 @@ public:
}
};
class maxProcEqOp
{
public:
void operator()(nearInfo& x, const nearInfo& y) const
{
if (y.first().hit())
{
if (!x.first().hit())
{
x = y;
}
else if (y.second().second() > x.second().second())
{
x = y;
}
}
}
};
protected:
@ -159,7 +185,7 @@ protected:
//- What to sample
const sampleMode mode_;
//- Patch (only if NEARESTPATCHFACE)
//- Patch (if in sampleMode NEARESTPATCH*)
const word samplePatch_;
//- How to obtain samples
@ -187,7 +213,7 @@ protected:
mutable autoPtr<mapDistribute> mapPtr_;
// AMI interpolator
// AMI interpolator (only for NEARESTPATCHFACEAMI)
//- Pointer to AMI interpolator
mutable autoPtr<AMIPatchToPatchInterpolation> AMIPtr_;

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,6 +58,10 @@ inline Foam::label Foam::mappedPatchBase::sampleSize() const
{
return samplePolyPatch().size();
}
case NEARESTPATCHPOINT:
{
return samplePolyPatch().nPoints();
}
case NEARESTFACE:
{
const polyMesh& mesh = sampleMesh();

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-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -124,8 +124,7 @@ inline bool Foam::topoDistanceData::updateCell
{
if (distance_ == -1)
{
data_ = neighbourInfo.data_;
distance_ = neighbourInfo.distance_ + 1;
operator=(neighbourInfo);
return true;
}
else
@ -151,7 +150,8 @@ inline bool Foam::topoDistanceData::updateFace
if (distance_ == -1)
{
operator=(neighbourInfo);
data_ = neighbourInfo.data_;
distance_ = neighbourInfo.distance_ + 1;
return true;
}
else

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) 2012-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -198,7 +198,7 @@ Foam::labelList Foam::structuredRenumber::renumber
}
else
{
label layerI = cellData[cellI].distance()-1;
label layerI = cellData[cellI].distance();
if (depthFirst_)
{
orderedToOld[nLayers*cellData[cellI].data()+layerI] = cellI;