mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
cyclicAMIPolyPatch: Correct particle transformations across cyclic AMI patches
Patch provided by Daniel Jasiński Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1694
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1051,10 +1051,10 @@ void Foam::particle::hitCyclicAMIPatch
|
||||
{
|
||||
const cyclicAMIPolyPatch& receiveCpp = cpp.neighbPatch();
|
||||
|
||||
// patch face index on sending side
|
||||
// Patch face index on sending side
|
||||
label patchFaceI = faceI_ - cpp.start();
|
||||
|
||||
// patch face index on receiving side - also updates position
|
||||
// Patch face index on receiving side - also updates position
|
||||
patchFaceI = cpp.pointFace(patchFaceI, direction, position_);
|
||||
|
||||
if (patchFaceI < 0)
|
||||
@ -1074,7 +1074,7 @@ void Foam::particle::hitCyclicAMIPatch
|
||||
<< " at position " << position_ << abort(FatalError);
|
||||
}
|
||||
|
||||
// convert face index into global numbering
|
||||
// Convert face index into global numbering
|
||||
faceI_ = patchFaceI + receiveCpp.start();
|
||||
|
||||
cellI_ = mesh_.faceOwner()[faceI_];
|
||||
@ -1086,9 +1086,6 @@ void Foam::particle::hitCyclicAMIPatch
|
||||
|
||||
// Now the particle is on the receiving side
|
||||
|
||||
// Have patch transform the position
|
||||
receiveCpp.transformPosition(position_, patchFaceI);
|
||||
|
||||
// Transform the properties
|
||||
if (!receiveCpp.parallel())
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,13 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cyclicAMIPolyPatch.H"
|
||||
#include "transformField.H"
|
||||
#include "SubField.H"
|
||||
#include "polyMesh.H"
|
||||
#include "Time.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "faceAreaIntersect.H"
|
||||
#include "ops.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -165,13 +161,13 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
|
||||
+ sin(-rotationAngle_)*S
|
||||
);
|
||||
|
||||
// check - assume correct angle when difference in face areas
|
||||
// Check - assume correct angle when difference in face areas
|
||||
// is the smallest
|
||||
vector transformedAreaPos = gSum(half1Areas & revTPos);
|
||||
vector transformedAreaNeg = gSum(half1Areas & revTNeg);
|
||||
vector area0 = gSum(half0Areas);
|
||||
|
||||
// areas have opposite sign, so sum should be zero when
|
||||
// Areas have opposite sign, so sum should be zero when
|
||||
// correct rotation applied
|
||||
scalar errorPos = mag(transformedAreaPos + area0);
|
||||
scalar errorNeg = mag(transformedAreaNeg + area0);
|
||||
@ -357,7 +353,7 @@ void Foam::cyclicAMIPolyPatch::resetAMI
|
||||
meshTools::writeOBJ(os, neighbPatch().localFaces(), nbrPoints);
|
||||
}
|
||||
|
||||
// transform neighbour patch to local system
|
||||
// Transform neighbour patch to local system
|
||||
transformPosition(nbrPoints);
|
||||
primitivePatch nbrPatch0
|
||||
(
|
||||
@ -617,7 +613,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||
}
|
||||
default:
|
||||
{
|
||||
// no additional info required
|
||||
// No additional info required
|
||||
}
|
||||
}
|
||||
|
||||
@ -922,6 +918,64 @@ void Foam::cyclicAMIPolyPatch::transformPosition
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicAMIPolyPatch::reverseTransformPosition
|
||||
(
|
||||
point& l,
|
||||
const label faceI
|
||||
) const
|
||||
{
|
||||
if (!parallel())
|
||||
{
|
||||
const tensor& T =
|
||||
(
|
||||
reverseT().size() == 1
|
||||
? reverseT()[0]
|
||||
: reverseT()[faceI]
|
||||
);
|
||||
|
||||
if (transform() == ROTATIONAL)
|
||||
{
|
||||
l = Foam::transform(T, l - rotationCentre_) + rotationCentre_;
|
||||
}
|
||||
else
|
||||
{
|
||||
l = Foam::transform(T, l);
|
||||
}
|
||||
}
|
||||
else if (separated())
|
||||
{
|
||||
const vector& s =
|
||||
(
|
||||
separation().size() == 1
|
||||
? separation()[0]
|
||||
: separation()[faceI]
|
||||
);
|
||||
|
||||
l += s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicAMIPolyPatch::reverseTransformDirection
|
||||
(
|
||||
vector& d,
|
||||
const label faceI
|
||||
) const
|
||||
{
|
||||
if (!parallel())
|
||||
{
|
||||
const tensor& T =
|
||||
(
|
||||
reverseT().size() == 1
|
||||
? reverseT()[0]
|
||||
: reverseT()[faceI]
|
||||
);
|
||||
|
||||
d = Foam::transform(T, d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicAMIPolyPatch::calcGeometry
|
||||
(
|
||||
const primitivePatch& referPatch,
|
||||
@ -966,7 +1020,6 @@ bool Foam::cyclicAMIPolyPatch::order
|
||||
rotation.setSize(pp.size());
|
||||
rotation = 0;
|
||||
|
||||
// do nothing
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -978,28 +1031,43 @@ Foam::label Foam::cyclicAMIPolyPatch::pointFace
|
||||
point& p
|
||||
) const
|
||||
{
|
||||
point prt(p);
|
||||
reverseTransformPosition(prt, faceI);
|
||||
|
||||
vector nrt(n);
|
||||
reverseTransformDirection(nrt, faceI);
|
||||
|
||||
label nbrFaceI = -1;
|
||||
|
||||
if (owner())
|
||||
{
|
||||
return AMI().tgtPointFace
|
||||
nbrFaceI = AMI().tgtPointFace
|
||||
(
|
||||
*this,
|
||||
neighbPatch(),
|
||||
n,
|
||||
nrt,
|
||||
faceI,
|
||||
p
|
||||
prt
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return neighbPatch().AMI().srcPointFace
|
||||
nbrFaceI = neighbPatch().AMI().srcPointFace
|
||||
(
|
||||
neighbPatch(),
|
||||
*this,
|
||||
n,
|
||||
nrt,
|
||||
faceI,
|
||||
p
|
||||
prt
|
||||
);
|
||||
}
|
||||
|
||||
if (nbrFaceI >= 0)
|
||||
{
|
||||
p = prt;
|
||||
}
|
||||
|
||||
return nbrFaceI;
|
||||
}
|
||||
|
||||
|
||||
@ -1042,7 +1110,7 @@ void Foam::cyclicAMIPolyPatch::write(Ostream& os) const
|
||||
}
|
||||
default:
|
||||
{
|
||||
// no additional info to write
|
||||
// No additional info to write
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -329,6 +329,20 @@ public:
|
||||
const label faceI
|
||||
) const;
|
||||
|
||||
//- Transform a patch-based position from this side to nbr side
|
||||
virtual void reverseTransformPosition
|
||||
(
|
||||
point& l,
|
||||
const label faceI
|
||||
) const;
|
||||
|
||||
//- Transform a patch-based direction from this side to nbr side
|
||||
virtual void reverseTransformDirection
|
||||
(
|
||||
vector& d,
|
||||
const label faceI
|
||||
) const;
|
||||
|
||||
|
||||
// Interpolations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user