diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index 682e9962b6..8a90ad9d53 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -254,7 +254,10 @@ public: } //- Transform a patch-based position from other side to this side - virtual void transformPosition(pointField& l) const = 0; + virtual void transformPosition(pointField&) const = 0; + + //- Transform a patch-based position from other side to this side + virtual void transformPosition(point&, const label facei) const = 0; //- Are the planes separated. virtual bool separated() const @@ -297,12 +300,12 @@ public: virtual void calcGeometry ( const primitivePatch& referPatch, - const UList& thisCtrs, - const UList& thisAreas, - const UList& thisCc, - const UList& nbrCtrs, - const UList& nbrAreas, - const UList& nbrCc + const pointField& thisCtrs, + const vectorField& thisAreas, + const pointField& thisCc, + const pointField& nbrCtrs, + const vectorField& nbrAreas, + const pointField& nbrCc ) = 0; //- Initialize ordering for primitivePatch. Does not diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 03032fbb53..0c8b033fbc 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -77,7 +77,6 @@ void Foam::cyclicPolyPatch::calcTransforms() if (size()) { // Half0 - const cyclicPolyPatch& half0 = *this; vectorField half0Areas(half0.size()); forAll(half0, facei) @@ -108,10 +107,10 @@ void Foam::cyclicPolyPatch::calcTransforms() void Foam::cyclicPolyPatch::calcTransforms ( const primitivePatch& half0, - const UList& half0Ctrs, - const UList& half0Areas, - const UList& half1Ctrs, - const UList& half1Areas + const pointField& half0Ctrs, + const vectorField& half0Areas, + const pointField& half1Ctrs, + const vectorField& half1Areas ) { if (debug && owner()) @@ -165,23 +164,9 @@ void Foam::cyclicPolyPatch::calcTransforms if (half0Ctrs.size() > 0) { - scalarField half0Tols - ( - calcFaceTol - ( - half0, - half0.points(), - static_cast(half0Ctrs) - ) - ); - vectorField half0Normals(half0Areas.size()); vectorField half1Normals(half1Areas.size()); - //- Additional warning about faces non-aligned with rotation axis - //scalar maxCos = -GREAT; - //label maxFacei = -1; - forAll(half0, facei) { scalar magSf = mag(half0Areas[facei]); @@ -221,75 +206,74 @@ void Foam::cyclicPolyPatch::calcTransforms { half0Normals[facei] = half0Areas[facei] / magSf; half1Normals[facei] = half1Areas[facei] / nbrMagSf; - - //if (transform_ == ROTATIONAL) - //{ - // scalar cos = mag(half0Normals[facei] & rotationAxis_); - // if (cos > maxCos) - // { - // maxCos = cos; - // maxFacei = facei; - // } - //} } } - //if (maxCos > sqrt(SMALL)) - //{ - // WarningIn - // ( - // "cyclicPolyPatch::calcTransforms()" - // ) << "on patch " << name() - // << " face:" << maxFacei << " fc:" << half0Ctrs[maxFacei] - // << " is not perpendicular to the rotationAxis." << endl - // << "This will cause problems with topology changes." << endl - // << "rotation axis : " << rotationAxis_ << endl - // << "face normal : " << half0Normals[maxFacei] << endl - // << "cosine of angle : " << maxCos << endl; - //} // Calculate transformation tensors - calcTransformTensors - ( - static_cast(half0Ctrs), - static_cast(half1Ctrs), - half0Normals, - half1Normals, - half0Tols, - matchTol, - transform_ - ); - if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1) + if (transform_ == ROTATIONAL) { - // Get index of maximum area face to minimise truncation errors. - label max0I = findMaxArea(half0.points(), half0); + // Calculate using the given rotation axis and centre. Do not + // use calculated normals. + label face0 = getConsistentRotationFace(half0Ctrs); + label face1 = face0; - const tensor fwdT = forwardT()[max0I]; - const_cast(forwardT()) = tensorField(1, fwdT); - const tensor revT = reverseT()[max0I]; - const_cast(reverseT()) = tensorField(1, revT); - const bool coll = collocated()[max0I]; - const_cast(collocated()).setSize(1); - const_cast(collocated())[0] = coll; + vector n0 = ((half0Ctrs[face0] - rotationCentre_) ^ rotationAxis_); + vector n1 = ((half1Ctrs[face1] - rotationCentre_) ^ -rotationAxis_); + n0 /= mag(n0) + VSMALL; + n1 /= mag(n1) + VSMALL; - WarningIn + if (debug) + { + Pout<< "cyclicPolyPatch::calcTransforms :" + << " Specified rotation :" + << " n0:" << n0 << " n1:" << n1 << endl; + } + + // Extended tensor from two local coordinate systems calculated + // using normal and rotation axis + const tensor E0 ( - "cyclicPolyPatch::calcTransforms\n" - " (\n" - " const primitivePatch&,\n" - " const UList&,\n" - " const UList&,\n" - " const UList&,\n" - " const UList&\n" - " )" - ) << "For patch " << name() - << " calculated non-uniform transform tensor even though" - << " the transform type is " << transformTypeNames[transform_] - << "." << nl - << " Setting the transformation tensor to be a uniform" - << " rotation calculated from face " << max0I - << endl; + rotationAxis_, + (n0 ^ rotationAxis_), + n0 + ); + const tensor E1 + ( + rotationAxis_, + (-n1 ^ rotationAxis_), + -n1 + ); + const tensor revT(E1.T() & E0); + + const_cast(forwardT()) = tensorField(1, revT.T()); + const_cast(reverseT()) = tensorField(1, revT); + const_cast(separation()).setSize(0); + const_cast(collocated()) = boolList(1, false); + } + else + { + scalarField half0Tols + ( + calcFaceTol + ( + half0, + half0.points(), + static_cast(half0Ctrs) + ) + ); + + calcTransformTensors + ( + static_cast(half0Ctrs), + static_cast(half1Ctrs), + half0Normals, + half1Normals, + half0Tols, + matchTol, + transform_ + ); } } } @@ -333,14 +317,39 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors << " n0:" << n0 << " n1:" << n1 << endl; } - // Rotation (around origin) - const tensor reverseT(rotationTensor(n0, -n1)); + // Extended tensor from two local coordinate systems calculated + // using normal and rotation axis + const tensor E0 + ( + rotationAxis_, + (n0 ^ rotationAxis_), + n0 + ); + const tensor E1 + ( + rotationAxis_, + (-n1 ^ rotationAxis_), + -n1 + ); + const tensor revT(E1.T() & E0); // Rotation forAll(half0Ctrs, faceI) { - half0Ctrs[faceI] = Foam::transform(reverseT, half0Ctrs[faceI]); - anchors0[faceI] = Foam::transform(reverseT, anchors0[faceI]); + half0Ctrs[faceI] = + Foam::transform + ( + revT, + half0Ctrs[faceI] - rotationCentre_ + ) + + rotationCentre_; + anchors0[faceI] = + Foam::transform + ( + revT, + anchors0[faceI] - rotationCentre_ + ) + + rotationCentre_; } break; @@ -387,19 +396,19 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors } // Rotation (around origin) - const tensor reverseT(rotationTensor(n0, -n1)); + const tensor revT(rotationTensor(n0, -n1)); // Rotation forAll(half0Ctrs, faceI) { half0Ctrs[faceI] = Foam::transform ( - reverseT, + revT, half0Ctrs[faceI] ); anchors0[faceI] = Foam::transform ( - reverseT, + revT, anchors0[faceI] ); } @@ -437,41 +446,20 @@ Foam::label Foam::cyclicPolyPatch::getConsistentRotationFace const pointField& faceCentres ) const { - const scalarField magRadSqr - ( - magSqr((faceCentres - rotationCentre_) ^ rotationAxis_) - ); - scalarField axisLen - ( - (faceCentres - rotationCentre_) & rotationAxis_ - ); - axisLen -= min(axisLen); - const scalarField magLenSqr - ( - magRadSqr + axisLen*axisLen - ); + // Determine a face furthest away from the axis - label rotFace = -1; - scalar maxMagLenSqr = -GREAT; - scalar maxMagRadSqr = -GREAT; - forAll(faceCentres, i) - { - if (magLenSqr[i] >= maxMagLenSqr) - { - if (magRadSqr[i] > maxMagRadSqr) - { - rotFace = i; - maxMagLenSqr = magLenSqr[i]; - maxMagRadSqr = magRadSqr[i]; - } - } - } + const scalarField magRadSqr = + magSqr((faceCentres - rotationCentre_) ^ rotationAxis_); + + label rotFace = findMax(magRadSqr); if (debug) { - Pout<< "getConsistentRotationFace(const pointField&)" << nl - << " rotFace = " << rotFace << nl - << " point = " << faceCentres[rotFace] << endl; + Info<< "getConsistentRotationFace(const pointField&)" << nl + << " rotFace = " << rotFace << nl + << " point = " << faceCentres[rotFace] << nl + << " distance = " << Foam::sqrt(magRadSqr[rotFace]) + << endl; } return rotFace; @@ -586,6 +574,17 @@ Foam::cyclicPolyPatch::cyclicPolyPatch { dict.lookup("rotationAxis") >> rotationAxis_; dict.lookup("rotationCentre") >> rotationCentre_; + + scalar magRot = mag(rotationAxis_); + if (magRot < SMALL) + { + FatalIOErrorIn("cyclicPolyPatch::cyclicPolyPatch(..)", dict) + << "Illegal rotationAxis " << rotationAxis_ << endl + << "Please supply a non-zero vector." + << exit(FatalIOError); + } + rotationAxis_ /= magRot; + break; } case TRANSLATIONAL: @@ -730,7 +729,16 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const { if (!parallel()) { - l = Foam::transform(forwardT(), l); + if (transform_ == ROTATIONAL) + { + l = + Foam::transform(forwardT(), l-rotationCentre_) + + rotationCentre_; + } + else + { + l = Foam::transform(forwardT(), l); + } } else if (separated()) { @@ -750,6 +758,40 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const } +void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const +{ + if (!parallel()) + { + const tensor& T = + ( + forwardT().size() == 1 + ? forwardT()[0] + : forwardT()[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::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs) { polyPatch::initGeometry(pBufs); @@ -759,9 +801,9 @@ void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs) void Foam::cyclicPolyPatch::initGeometry ( const primitivePatch& referPatch, - UList& nbrCtrs, - UList& nbrAreas, - UList& nbrCc + pointField& nbrCtrs, + vectorField& nbrAreas, + pointField& nbrCc ) {} @@ -769,12 +811,12 @@ void Foam::cyclicPolyPatch::initGeometry void Foam::cyclicPolyPatch::calcGeometry ( const primitivePatch& referPatch, - const UList& thisCtrs, - const UList& thisAreas, - const UList& thisCc, - const UList& nbrCtrs, - const UList& nbrAreas, - const UList& nbrCc + const pointField& thisCtrs, + const vectorField& thisAreas, + const pointField& thisCc, + const pointField& nbrCtrs, + const vectorField& nbrAreas, + const pointField& nbrCc ) { calcTransforms diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H index 68a008bded..77c680b943 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H @@ -110,10 +110,10 @@ class cyclicPolyPatch void calcTransforms ( const primitivePatch& half0, - const UList& half0Ctrs, - const UList& half0Areas, - const UList& half1Ctrs, - const UList& half1Areas + const pointField& half0Ctrs, + const vectorField& half0Areas, + const pointField& half1Ctrs, + const vectorField& half1Areas ); // Face ordering @@ -149,9 +149,9 @@ protected: virtual void initGeometry ( const primitivePatch& referPatch, - UList& nbrCtrs, - UList& nbrAreas, - UList& nbrCc + pointField& nbrCtrs, + vectorField& nbrAreas, + pointField& nbrCc ); //- Calculate the patch geometry @@ -161,12 +161,12 @@ protected: virtual void calcGeometry ( const primitivePatch& referPatch, - const UList& thisCtrs, - const UList& thisAreas, - const UList& thisCc, - const UList& nbrCtrs, - const UList& nbrAreas, - const UList& nbrCc + const pointField& thisCtrs, + const vectorField& thisAreas, + const pointField& thisCc, + const pointField& nbrCtrs, + const vectorField& nbrAreas, + const pointField& nbrCc ); //- Initialise the patches for moving points @@ -342,6 +342,9 @@ public: //- Transform a patch-based position from other side to this side virtual void transformPosition(pointField& l) const; + //- Transform a patch-based position from other side to this side + virtual void transformPosition(point&, const label facei) const; + // Transformation diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C index 94c4d4f689..4f782c4d30 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -711,12 +711,12 @@ void Foam::oldCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs) void Foam::oldCyclicPolyPatch::calcGeometry ( const primitivePatch& referPatch, - const UList& thisCtrs, - const UList& thisAreas, - const UList& thisCc, - const UList& nbrCtrs, - const UList& nbrAreas, - const UList& nbrCc + const pointField& thisCtrs, + const vectorField& thisAreas, + const pointField& thisCc, + const pointField& nbrCtrs, + const vectorField& nbrAreas, + const pointField& nbrCc ) {} diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H index 947f9f7846..33c98f5844 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -269,16 +269,22 @@ public: notImplemented("transformPosition(pointField&)"); } + //- Transform a patch-based position from other side to this side + virtual void transformPosition(point&, const label facei) const + { + notImplemented("transformPosition(point&, const label)"); + } + //- Calculate the patch geometry virtual void calcGeometry ( const primitivePatch& referPatch, - const UList& thisCtrs, - const UList& thisAreas, - const UList& thisCc, - const UList& nbrCtrs, - const UList& nbrAreas, - const UList& nbrCc + const pointField& thisCtrs, + const vectorField& thisAreas, + const pointField& thisCc, + const pointField& nbrCtrs, + const vectorField& nbrAreas, + const pointField& nbrCc ); //- Initialize ordering for primitivePatch. Does not diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H index 409e5e94c2..2ea17f18fb 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,12 +93,12 @@ protected: virtual void calcGeometry ( const primitivePatch& referPatch, - const UList& thisCtrs, - const UList& thisAreas, - const UList& thisCc, - const UList& nbrCtrs, - const UList& nbrAreas, - const UList& nbrCc + const pointField& thisCtrs, + const vectorField& thisAreas, + const pointField& thisCc, + const pointField& nbrCtrs, + const vectorField& nbrAreas, + const pointField& nbrCc ) { notImplemented("processorPolyPatch::calcGeometry(..)"); @@ -300,6 +300,10 @@ public: virtual void transformPosition(pointField& l) const {} + //- Transform a patch-based position from other side to this side + virtual void transformPosition(point&, const label facei) const + {} + //- Initialize ordering for primitivePatch. Does not // refer to *this (except for name() and type() etc.) virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H index a4b929a5ba..f1921a2cc5 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H @@ -81,12 +81,12 @@ protected: virtual void calcGeometry ( const primitivePatch& referPatch, - const UList& thisCtrs, - const UList& thisAreas, - const UList& thisCc, - const UList& nbrCtrs, - const UList& nbrAreas, - const UList& nbrCc + const pointField& thisCtrs, + const vectorField& thisAreas, + const pointField& thisCc, + const pointField& nbrCtrs, + const vectorField& nbrAreas, + const pointField& nbrCc ) { notImplemented("processorCyclicPolyPatch::calcGeometry(..)"); @@ -279,6 +279,12 @@ public: referPatch().transformPosition(l); } + //- Transform a patch-based position from other side to this side + virtual void transformPosition(point& l, const label facei) const + { + referPatch().transformPosition(l, facei); + } + //- Are the planes separated. virtual bool separated() const { diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 191544d7d6..37cfc28376 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -114,7 +114,8 @@ derivedFvPatchFields = $(fvPatchFields)/derived $(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C $(derivedFvPatchFields)/activePressureForceBaffleVelocity/activePressureForceBaffleVelocityFvPatchVectorField.C $(derivedFvPatchFields)/advective/advectiveFvPatchFields.C -$(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchScalarField.C +/* $(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchScalarField.C */ +$(derivedFvPatchFields)/codedFixedValue/codedFixedValueFvPatchFields.C $(derivedFvPatchFields)/directMappedField/directMappedFieldFvPatchFields.C $(derivedFvPatchFields)/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C $(derivedFvPatchFields)/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C index c4ed3fd7d6..38c45bf57f 100644 --- a/src/lagrangian/basic/particle/particle.C +++ b/src/lagrangian/basic/particle/particle.C @@ -116,12 +116,6 @@ Foam::particle::particle(const particle& p, const polyMesh& mesh) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::particle::transformPosition(const tensor& T) -{ - position_ = transform(T, position_); -} - - void Foam::particle::transformProperties(const tensor&) {} diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H index d6d9210d35..df64e7b9e7 100644 --- a/src/lagrangian/basic/particle/particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -491,10 +491,6 @@ public: // Transformations - //- Transform the position the particle - // according to the given transformation tensor - virtual void transformPosition(const tensor& T); - //- Transform the physical properties of the particle // according to the given transformation tensor virtual void transformProperties(const tensor& T); diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index f497313b64..2f8053677b 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -52,11 +52,15 @@ void Foam::particle::correctAfterParallelTransfer TrackData& td ) { - const processorPolyPatch& ppp = - refCast(mesh_.boundaryMesh()[patchI]); + const coupledPolyPatch& ppp = + refCast(mesh_.boundaryMesh()[patchI]); cellI_ = ppp.faceCells()[faceI_]; + // Have patch transform the position + ppp.transformPosition(position_, faceI_); + + // Transform the properties if (!ppp.parallel()) { const tensor& T = @@ -65,8 +69,6 @@ void Foam::particle::correctAfterParallelTransfer ? ppp.forwardT()[0] : ppp.forwardT()[faceI_] ); - - transformPosition(T); transformProperties(T); } else if (ppp.separated()) @@ -77,7 +79,6 @@ void Foam::particle::correctAfterParallelTransfer ? ppp.separation()[0] : ppp.separation()[faceI_] ); - position_ -= s; transformProperties(-s); } @@ -958,19 +959,22 @@ void Foam::particle::hitCyclicPatch tetPtI_ = mesh_.faces()[tetFaceI_].size() - 1 - tetPtI_; const cyclicPolyPatch& receiveCpp = cpp.neighbPatch(); + label patchFacei = receiveCpp.whichFace(faceI_); // Now the particle is on the receiving side + // Have patch transform the position + receiveCpp.transformPosition(position_, patchFacei); + + // Transform the properties if (!receiveCpp.parallel()) { const tensor& T = ( receiveCpp.forwardT().size() == 1 ? receiveCpp.forwardT()[0] - : receiveCpp.forwardT()[receiveCpp.whichFace(faceI_)] + : receiveCpp.forwardT()[patchFacei] ); - - transformPosition(T); transformProperties(T); } else if (receiveCpp.separated()) @@ -979,9 +983,8 @@ void Foam::particle::hitCyclicPatch ( (receiveCpp.separation().size() == 1) ? receiveCpp.separation()[0] - : receiveCpp.separation()[receiveCpp.whichFace(faceI_)] + : receiveCpp.separation()[patchFacei] ); - position_ -= s; transformProperties(-s); } }