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

Conflicts:
	doc/Doxygen/css/doxygen.css
This commit is contained in:
mattijs
2013-12-02 11:30:36 +00:00
147 changed files with 3845 additions and 1494 deletions

View File

@ -90,16 +90,16 @@ void Foam::cyclicACMIPolyPatch::resetAMI
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight
);
const scalarField& srcWeightSum = AMI().srcWeightsSum();
srcMask_ =
min(1.0 - tolerance_, max(tolerance_, AMI().srcWeightsSum()));
tgtMask_ =
min(1.0 - tolerance_, max(tolerance_, AMI().tgtWeightsSum()));
// set patch face areas based on sum of AMI weights per face
forAll(Sf, faceI)
{
scalar w = srcWeightSum[faceI];
w = min(1.0 - tolerance_, max(tolerance_, w));
Sf[faceI] *= w;
noSf[faceI] *= 1.0 - w;
Sf[faceI] *= srcMask_[faceI];
noSf[faceI] *= 1.0 - srcMask_[faceI];
}
setNeighbourFaceAreas();
@ -116,8 +116,6 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const
refCast<const cyclicACMIPolyPatch>(this->neighbPatch());
const polyPatch& pp = cp.nonOverlapPatch();
const scalarField& tgtWeightSum = AMI().tgtWeightsSum();
const vectorField& faceAreas0 = cp.faceAreas0();
vectorField::subField Sf = cp.faceAreas();
@ -125,11 +123,8 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const
forAll(Sf, faceI)
{
scalar w = tgtWeightSum[faceI];
w = min(1.0 - tolerance_, max(tolerance_, w));
Sf[faceI] = w*faceAreas0[faceI];
noSf[faceI] = (1.0 - w)*faceAreas0[faceI];
Sf[faceI] = tgtMask_[faceI]*faceAreas0[faceI];
noSf[faceI] = (1.0 - tgtMask_[faceI])*faceAreas0[faceI];
}
}
@ -184,6 +179,18 @@ void Foam::cyclicACMIPolyPatch::clearGeom()
}
const Foam::scalarField& Foam::cyclicACMIPolyPatch::srcMask() const
{
return srcMask_;
}
const Foam::scalarField& Foam::cyclicACMIPolyPatch::tgtMask() const
{
return tgtMask_;
}
// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
@ -201,6 +208,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
faceAreas0_(),
nonOverlapPatchName_(word::null),
nonOverlapPatchID_(-1),
srcMask_(),
tgtMask_(),
updated_(false)
{
// Non-overlapping patch might not be valid yet so cannot determine
@ -221,6 +230,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
faceAreas0_(),
nonOverlapPatchName_(dict.lookup("nonOverlapPatch")),
nonOverlapPatchID_(-1),
srcMask_(),
tgtMask_(),
updated_(false)
{
if (nonOverlapPatchName_ == name)
@ -256,6 +267,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
faceAreas0_(),
nonOverlapPatchName_(pp.nonOverlapPatchName_),
nonOverlapPatchID_(-1),
srcMask_(),
tgtMask_(),
updated_(false)
{
// Non-overlapping patch might not be valid yet so cannot determine
@ -278,6 +291,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
faceAreas0_(),
nonOverlapPatchName_(nonOverlapPatchName),
nonOverlapPatchID_(-1),
srcMask_(),
tgtMask_(),
updated_(false)
{
if (nonOverlapPatchName_ == name())
@ -314,6 +329,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
faceAreas0_(),
nonOverlapPatchName_(pp.nonOverlapPatchName_),
nonOverlapPatchID_(-1),
srcMask_(),
tgtMask_(),
updated_(false)
{}
@ -326,6 +343,13 @@ Foam::cyclicACMIPolyPatch::~cyclicACMIPolyPatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::cyclicACMIPolyPatch& Foam::cyclicACMIPolyPatch::neighbPatch() const
{
const polyPatch& pp = this->boundaryMesh()[neighbPatchID()];
return refCast<const cyclicACMIPolyPatch>(pp);
}
Foam::label Foam::cyclicACMIPolyPatch::nonOverlapPatchID() const
{
if (nonOverlapPatchID_ == -1)

View File

@ -66,6 +66,12 @@ private:
//- Index of non-overlapping patch
mutable label nonOverlapPatchID_;
//- Mask/weighting for source patch
mutable scalarField srcMask_;
//- Mask/weighting for target patch
mutable scalarField tgtMask_;
//- Flag to indicate that AMI has been updated
mutable bool updated_;
@ -111,6 +117,12 @@ protected:
//- Clear geometry
virtual void clearGeom();
//- Return the mask/weighting for the source patch
virtual const scalarField& srcMask() const;
//- Return the mask/weighting for the target patch
virtual const scalarField& tgtMask() const;
public:
@ -245,6 +257,9 @@ public:
//- Return access to the original patch face areas
inline const vectorField& faceAreas0() const;
//- Return a reference to the neighbour patch
virtual const cyclicACMIPolyPatch& neighbPatch() const;
//- Non-overlapping patch name
inline const word& nonOverlapPatchName() const;

View File

@ -71,11 +71,11 @@ inline const Foam::scalarField& Foam::cyclicACMIPolyPatch::mask() const
{
if (owner())
{
return AMI().srcWeightsSum();
return srcMask_;
}
else
{
return neighbPatch().AMI().tgtWeightsSum();
return neighbPatch().tgtMask();
}
}

View File

@ -34,7 +34,7 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIPolyPatch::interpolate
{
if (owner())
{
const scalarField& w = AMI().srcWeightsSum();
const scalarField& w = srcMask_;
return
w*AMI().interpolateToSource(fldCouple)
@ -42,7 +42,7 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIPolyPatch::interpolate
}
else
{
const scalarField& w = neighbPatch().AMI().tgtWeightsSum();
const scalarField& w = neighbPatch().tgtMask();
return
w*neighbPatch().AMI().interpolateToTarget(fldCouple)
@ -73,14 +73,14 @@ void Foam::cyclicACMIPolyPatch::interpolate
{
if (owner())
{
const scalarField& w = AMI().srcWeightsSum();
const scalarField& w = srcMask_;
AMI().interpolateToSource(fldCouple, cop, result);
result = w*result + (1.0 - w)*fldNonOverlap;
}
else
{
const scalarField& w = neighbPatch().AMI().tgtWeightsSum();
const scalarField& w = neighbPatch().tgtMask();
neighbPatch().AMI().interpolateToTarget(fldCouple, cop, result);
result = w*result + (1.0 - w)*fldNonOverlap;

View File

@ -642,6 +642,13 @@ bool Foam::cyclicAMIPolyPatch::owner() const
}
const Foam::cyclicAMIPolyPatch& Foam::cyclicAMIPolyPatch::neighbPatch() const
{
const polyPatch& pp = this->boundaryMesh()[neighbPatchID()];
return refCast<const cyclicAMIPolyPatch>(pp);
}
const Foam::autoPtr<Foam::searchableSurface>&
Foam::cyclicAMIPolyPatch::surfPtr() const
{

View File

@ -284,7 +284,7 @@ public:
virtual bool owner() const;
//- Return a reference to the neighbour patch
inline const cyclicAMIPolyPatch& neighbPatch() const;
virtual const cyclicAMIPolyPatch& neighbPatch() const;
//- Return a reference to the projection surface
const autoPtr<searchableSurface>& surfPtr() const;

View File

@ -38,14 +38,6 @@ inline const Foam::word& Foam::cyclicAMIPolyPatch::neighbPatchName() const
}
inline const Foam::cyclicAMIPolyPatch&
Foam::cyclicAMIPolyPatch::neighbPatch() const
{
const polyPatch& pp = this->boundaryMesh()[neighbPatchID()];
return refCast<const cyclicAMIPolyPatch>(pp);
}
inline const Foam::vector& Foam::cyclicAMIPolyPatch::rotationAxis() const
{
return rotationAxis_;

View File

@ -203,7 +203,7 @@ void Foam::mappedPatchBase::findSamples
{
case NEARESTCELL:
{
if (samplePatch().size() && samplePatch() != "none")
if (samplePatch_.size() && samplePatch_ != "none")
{
FatalErrorIn
(
@ -495,7 +495,6 @@ void Foam::mappedPatchBase::findSamples
void Foam::mappedPatchBase::calcMapping() const
{
static bool hasWarned = false;
if (mapPtr_.valid())
{
FatalErrorIn("mappedPatchBase::calcMapping() const")
@ -509,10 +508,8 @@ void Foam::mappedPatchBase::calcMapping() const
// Get offsetted points
const pointField offsettedPoints(samplePoints(patchPoints()));
// Do a sanity check
// Am I sampling my own patch? This only makes sense for a non-zero
// offset.
// Do a sanity check - am I sampling my own patch?
// This only makes sense for a non-zero offset.
bool sampleMyself =
(
mode_ == NEARESTPATCHFACE
@ -550,7 +547,6 @@ void Foam::mappedPatchBase::calcMapping() const
<< "offsetMode_:" << offsetModeNames_[offsetMode_] << endl;
}
// Get global list of all samples and the processor and face they come from.
pointField samples;
labelList patchFaceProcs;
@ -565,7 +561,6 @@ void Foam::mappedPatchBase::calcMapping() const
patchFc
);
// Find processor and cell/face samples are in and actual location.
labelList sampleProcs;
labelList sampleIndices;
@ -641,7 +636,6 @@ void Foam::mappedPatchBase::calcMapping() const
}
}
// Now we have all the data we need:
// - where sample originates from (so destination when mapping):
// patchFaces, patchFaceProcs.
@ -688,7 +682,6 @@ void Foam::mappedPatchBase::calcMapping() const
}
}
// Determine schedule.
mapPtr_.reset(new mapDistribute(sampleProcs, patchFaceProcs));
@ -806,38 +799,34 @@ void Foam::mappedPatchBase::calcAMI() const
}
AMIPtr_.clear();
/*
const polyPatch& nbr = samplePolyPatch();
// pointField nbrPoints(offsettedPoints());
pointField nbrPoints(nbr.localPoints());
if (debug)
{
const polyPatch& nbr = samplePolyPatch();
pointField nbrPoints(nbr.localPoints());
OFstream os(patch_.name() + "_neighbourPatch-org.obj");
meshTools::writeOBJ(os, samplePolyPatch().localFaces(), nbrPoints);
}
// transform neighbour patch to local system
primitivePatch nbrPatch0
(
SubList<face>
// transform neighbour patch to local system
primitivePatch nbrPatch0
(
nbr.localFaces(),
nbr.size()
),
nbrPoints
);
SubList<face>
(
nbr.localFaces(),
nbr.size()
),
nbrPoints
);
if (debug)
{
OFstream osN(patch_.name() + "_neighbourPatch-trans.obj");
meshTools::writeOBJ(osN, nbrPatch0, nbrPoints);
OFstream osO(patch_.name() + "_ownerPatch.obj");
meshTools::writeOBJ(osO, patch_.localFaces(), patch_.localPoints());
}
*/
// Construct/apply AMI interpolation to determine addressing and weights
AMIPtr_.reset
(

View File

@ -392,6 +392,7 @@ public:
//- Get the patch on the region
const polyPatch& samplePolyPatch() const;
// Helpers
//- Get the sample points