From 915b574d8ba3474142633a459e4b1571e4a4f452 Mon Sep 17 00:00:00 2001 From: Ivor Clifford Date: Thu, 20 Oct 2011 16:31:19 -0600 Subject: [PATCH 1/6] Bugfix - GGI separationOffset + user-select rejection algorithm --- .../GGIInterpolation/GGIInterpolation.H | 2 +- .../GGIInterpolation/GGIInterpolationName.C | 7 +++-- .../polyPatches/constraint/ggi/ggiPolyPatch.C | 26 ++++++++++++++++--- .../polyPatches/constraint/ggi/ggiPolyPatch.H | 7 ++++- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/OpenFOAM/interpolations/GGIInterpolation/GGIInterpolation.H b/src/OpenFOAM/interpolations/GGIInterpolation/GGIInterpolation.H index 4bfc06cd6..42540f6f7 100644 --- a/src/OpenFOAM/interpolations/GGIInterpolation/GGIInterpolation.H +++ b/src/OpenFOAM/interpolations/GGIInterpolation/GGIInterpolation.H @@ -95,7 +95,7 @@ public: ClassName("GGIInterpolation"); //- Quick reject names - static const NamedEnum quickRejectNames_; + static const NamedEnum quickRejectNames_; // Constructors diff --git a/src/OpenFOAM/interpolations/GGIInterpolation/GGIInterpolationName.C b/src/OpenFOAM/interpolations/GGIInterpolation/GGIInterpolationName.C index 0a4b75c92..3b06ad428 100644 --- a/src/OpenFOAM/interpolations/GGIInterpolation/GGIInterpolationName.C +++ b/src/OpenFOAM/interpolations/GGIInterpolation/GGIInterpolationName.C @@ -41,12 +41,15 @@ defineTypeNameAndDebug(Foam::GGIInterpolationName, 0); template<> const char* -Foam::NamedEnum::names[] = +Foam::NamedEnum::names[] = { - "3DDistance", + "distance3D", "AABB", + "bbOctree", "nSquared" }; +const Foam::NamedEnum + Foam::GGIInterpolationName::quickRejectNames_; // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C index 3e2424f87..664dffd09 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C @@ -200,8 +200,7 @@ void Foam::ggiPolyPatch::calcPatchToPatch() const 0, // Non-overlapping face tolerances 0, // HJ, 24/Oct/2008 true, // Rescale weighting factors. Bug fix, MB. -// ggiInterpolation::AABB - ggiInterpolation::BB_OCTREE // Octree search, MB. + reject_ // Quick rejection algorithm, default BB_OCTREE ); // Abort immediately if uncovered faces are present and the option @@ -464,6 +463,7 @@ Foam::ggiPolyPatch::ggiPolyPatch shadowName_(word::null), zoneName_(word::null), bridgeOverlap_(false), + reject_(ggiZoneInterpolation::BB_OCTREE), shadowIndex_(-1), zoneIndex_(-1), patchToPatchPtr_(NULL), @@ -485,13 +485,15 @@ Foam::ggiPolyPatch::ggiPolyPatch const polyBoundaryMesh& bm, const word& shadowName, const word& zoneName, - const bool bridgeOverlap + const bool bridgeOverlap, + const ggiZoneInterpolation::quickReject reject ) : coupledPolyPatch(name, size, start, index, bm), shadowName_(shadowName), zoneName_(zoneName), bridgeOverlap_(bridgeOverlap), + reject_(reject), shadowIndex_(-1), zoneIndex_(-1), patchToPatchPtr_(NULL), @@ -516,6 +518,7 @@ Foam::ggiPolyPatch::ggiPolyPatch shadowName_(dict.lookup("shadowPatch")), zoneName_(dict.lookup("zone")), bridgeOverlap_(dict.lookup("bridgeOverlap")), + reject_(ggiZoneInterpolation::BB_OCTREE), shadowIndex_(-1), zoneIndex_(-1), patchToPatchPtr_(NULL), @@ -525,7 +528,15 @@ Foam::ggiPolyPatch::ggiPolyPatch localParallelPtr_(NULL), receiveAddrPtr_(NULL), sendAddrPtr_(NULL) -{} +{ + if (dict.found("quickReject")) + { + reject_ = ggiZoneInterpolation::quickRejectNames_.read + ( + dict.lookup("quickReject") + ); + } +} Foam::ggiPolyPatch::ggiPolyPatch @@ -538,6 +549,7 @@ Foam::ggiPolyPatch::ggiPolyPatch shadowName_(pp.shadowName_), zoneName_(pp.zoneName_), bridgeOverlap_(pp.bridgeOverlap_), + reject_(pp.reject_), shadowIndex_(-1), zoneIndex_(-1), patchToPatchPtr_(NULL), @@ -564,6 +576,7 @@ Foam::ggiPolyPatch::ggiPolyPatch shadowName_(pp.shadowName_), zoneName_(pp.zoneName_), bridgeOverlap_(pp.bridgeOverlap_), + reject_(pp.reject_), shadowIndex_(-1), zoneIndex_(-1), patchToPatchPtr_(NULL), @@ -735,6 +748,11 @@ void Foam::ggiPolyPatch::initAddressing() { // Calculate transforms for correct GGI cut calcTransforms(); + + if(master()) + { + shadow().calcTransforms(); + } // Force zone addressing and remote zone addressing // (uses GGI interpolator) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.H index 85edd7abf..c96f41df6 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.H @@ -73,6 +73,9 @@ class ggiPolyPatch //- Use bridging to fix overlap error in interpolation Switch bridgeOverlap_; + //- Quick reject algorithm + ggiZoneInterpolation::quickReject reject_; + //- Shadow patch index. Delayed evaluation for construction mutable label shadowIndex_; @@ -212,7 +215,9 @@ public: const polyBoundaryMesh& bm, const word& shadowName, const word& zoneName, - const bool bridgeOverlap + const bool bridgeOverlap, + const ggiZoneInterpolation::quickReject + reject = ggiZoneInterpolation::BB_OCTREE ); //- Construct from dictionary From 58e2ce9500f789bb395b5ef9fb43cf4b9f5b3404 Mon Sep 17 00:00:00 2001 From: Ivor Clifford Date: Thu, 20 Oct 2011 16:37:10 -0600 Subject: [PATCH 2/6] Enable cyclicGgi interface for block solver --- .../BlockLduMatrix/BlockLduMatrixATmul.C | 71 +++++- .../BlockLduMatrix/scalarBlockLduMatrix.C | 227 +++++++++++++----- .../ggiLduInterfaceField.C | 8 + .../ggiLduInterfaceField.H | 22 ++ .../cyclicGgi/cyclicGgiFvPatchField.C | 29 +++ .../cyclicGgi/cyclicGgiFvPatchField.H | 19 ++ .../cyclicGgi/cyclicGgiFvPatchFields.C | 97 ++++++++ .../cyclicGgi/cyclicGgiFvPatchFields.H | 24 ++ 8 files changed, 431 insertions(+), 66 deletions(-) diff --git a/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrixATmul.C b/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrixATmul.C index 2d8c79231..1e4612ace 100644 --- a/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrixATmul.C +++ b/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/BlockLduMatrixATmul.C @@ -42,7 +42,7 @@ void Foam::BlockLduMatrix::Amul // Initialise the update of coupled interfaces initInterfaces(coupleUpper_, Ax, x); - + AmulCore(Ax, x); // Update coupled interfaces @@ -64,14 +64,43 @@ void Foam::BlockLduMatrix::AmulCore const unallocLabelList& u = lduAddr().upperAddr(); const unallocLabelList& l = lduAddr().lowerAddr(); + const TypeCoeffField& Diag = this->diag(); const TypeCoeffField& Upper = this->upper(); - // Diagonal multiplication, no indirection - multiply(Ax, Diag, x); - // Create multiplication function object typename BlockCoeff::multiply mult; + + // AmulCore must be additive to account for initialisation step + // in ldu interfaces. HJ, 6/Nov/2007 + // Fixed by IC 19/Oct/2011 + if (Diag.activeType() == blockCoeffBase::SCALAR) + { + const scalarTypeField& activeDiag = Diag.asScalar(); + + for (register label cellI = 0; cellI < u.size(); cellI++) + { + Ax[cellI] += mult(activeDiag[cellI], x[cellI]); + } + } + else if (Diag.activeType() == blockCoeffBase::LINEAR) + { + const linearTypeField& activeDiag = Diag.asLinear(); + + for (register label cellI = 0; cellI < u.size(); cellI++) + { + Ax[cellI] += mult(activeDiag[cellI], x[cellI]); + } + } + else if (Diag.activeType() == blockCoeffBase::SQUARE) + { + const squareTypeField& activeDiag = Diag.asSquare(); + + for (register label cellI = 0; cellI < u.size(); cellI++) + { + Ax[cellI] += mult(activeDiag[cellI], x[cellI]); + } + } // Lower multiplication @@ -209,12 +238,40 @@ void Foam::BlockLduMatrix::TmulCore const TypeCoeffField& Diag = this->diag(); const TypeCoeffField& Upper = this->upper(); - // Diagonal multiplication, no indirection - multiply(Tx, Diag, x); - // Create multiplication function object typename BlockCoeff::multiply mult; + // AmulCore must be additive to account for initialisation step + // in ldu interfaces. HJ, 6/Nov/2007 + // Fixed by IC 19/Oct/2011 + if (Diag.activeType() == blockCoeffBase::SCALAR) + { + const scalarTypeField& activeDiag = Diag.asScalar(); + + for (register label cellI = 0; cellI < u.size(); cellI++) + { + Tx[cellI] += mult(activeDiag[cellI], x[cellI]); + } + } + else if (Diag.activeType() == blockCoeffBase::LINEAR) + { + const linearTypeField& activeDiag = Diag.asLinear(); + + for (register label cellI = 0; cellI < u.size(); cellI++) + { + Tx[cellI] += mult(activeDiag[cellI], x[cellI]); + } + } + else if (Diag.activeType() == blockCoeffBase::SQUARE) + { + const squareTypeField& activeDiag = Diag.asSquare(); + + for (register label cellI = 0; cellI < u.size(); cellI++) + { + Tx[cellI] += mult(activeDiag[cellI].T(), x[cellI]); + } + } + // Upper multiplication if (Upper.activeType() == blockCoeffBase::SCALAR) diff --git a/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/scalarBlockLduMatrix.C b/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/scalarBlockLduMatrix.C index 83fc0c263..6ab563e0e 100644 --- a/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/scalarBlockLduMatrix.C +++ b/src/OpenFOAM/matrices/blockLduMatrix/BlockLduMatrix/scalarBlockLduMatrix.C @@ -247,37 +247,53 @@ void BlockLduMatrix::AmulCore const scalarField& x ) const { - const scalarField& Diag = diag(); - - for (register label rowI = 0; rowI < x.size(); rowI++) - { - Ax[rowI] = Diag[rowI]*x[rowI]; - } - // Note: pointer looping const label* const __restrict__ U = lduAddr().upperAddr().begin(); const label* const __restrict__ L = lduAddr().lowerAddr().begin(); + + const scalar* const __restrict__ X = x.begin(); + scalar* __restrict__ AX = Ax.begin(); + + if (thereIsDiag()) + { + const scalar* const __restrict__ diagPtr = diag().begin(); + register const label nCells = diag().size(); + for (register label cell=0; cell::TmulCore const scalarField& x ) const { - const scalarField& Diag = diag(); - - for (register label rowI = 0; rowI < x.size(); rowI++) - { - Tx[rowI] = Diag[rowI]*x[rowI]; - } - // Note: pointer looping const label* const __restrict__ U = lduAddr().upperAddr().begin(); const label* const __restrict__ L = lduAddr().lowerAddr().begin(); + + const scalar* const __restrict__ X = x.begin(); + scalar* __restrict__ TX = Tx.begin(); + + if (thereIsDiag()) + { + const scalar* const __restrict__ diagPtr = diag().begin(); + + register const label nCells = diag().size(); + for (register label cell=0; cell BlockLduMatrix::H(const scalarField& x) const const label* const __restrict__ U = lduAddr().upperAddr().begin(); const label* const __restrict__ L = lduAddr().lowerAddr().begin(); - const scalar* const __restrict__ Lower = lower().begin(); - const scalar* const __restrict__ Upper = upper().begin(); const scalar* const __restrict__ X = x.begin(); - - scalar* __restrict__ R = result.begin(); - - for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + + if (symmetric()) { - R[U[coeffI]] -= Upper[coeffI]*X[U[coeffI]]; + if (thereIsUpper()) + { + const scalar* const __restrict__ Upper = upper().begin(); + + scalar* __restrict__ R = result.begin(); + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[U[coeffI]] -= Upper[coeffI]*X[U[coeffI]]; + } + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[L[coeffI]] -= Upper[coeffI]*X[L[coeffI]]; + } + } + else if (thereIsLower()) + { + const scalar* const __restrict__ Lower = lower().begin(); + + scalar* __restrict__ R = result.begin(); + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[U[coeffI]] -= Lower[coeffI]*X[U[coeffI]]; + } + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[L[coeffI]] -= Lower[coeffI]*X[L[coeffI]]; + } + } } - - for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + else { - R[L[coeffI]] -= Lower[coeffI]*X[L[coeffI]]; + const scalar* const __restrict__ Lower = lower().begin(); + const scalar* const __restrict__ Upper = upper().begin(); + + scalar* __restrict__ R = result.begin(); + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[U[coeffI]] -= Upper[coeffI]*X[U[coeffI]]; + } + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[L[coeffI]] -= Lower[coeffI]*X[L[coeffI]]; + } } } - + return tresult; } @@ -396,19 +467,57 @@ tmp BlockLduMatrix::faceH(const scalarField& x) const if (thereIsUpper() || thereIsLower()) { - // Note: pointer looping - const label* const __restrict__ U = lduAddr().upperAddr().begin(); - const label* const __restrict__ L = lduAddr().lowerAddr().begin(); - - const scalar* const __restrict__ Lower = lower().begin(); - const scalar* const __restrict__ Upper = upper().begin(); - const scalar* const __restrict__ X = x.begin(); - - scalar* __restrict__ R = result.begin(); - - for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + if (symmetric()) { - R[coeffI] = Upper[coeffI]*X[U[coeffI]] - Lower[coeffI]*X[L[coeffI]]; + if (thereIsUpper()) + { + // Note: pointer looping + const label* const __restrict__ U = lduAddr().upperAddr().begin(); + const label* const __restrict__ L = lduAddr().lowerAddr().begin(); + + const scalar* const __restrict__ Upper = upper().begin(); + const scalar* const __restrict__ X = x.begin(); + + scalar* __restrict__ R = result.begin(); + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[coeffI] = Upper[coeffI]*(X[U[coeffI]] - X[L[coeffI]]); + } + } + else if (thereIsLower()) + { + // Note: pointer looping + const label* const __restrict__ U = lduAddr().upperAddr().begin(); + const label* const __restrict__ L = lduAddr().lowerAddr().begin(); + + const scalar* const __restrict__ Lower = lower().begin(); + const scalar* const __restrict__ X = x.begin(); + + scalar* __restrict__ R = result.begin(); + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[coeffI] = Lower[coeffI]*(X[U[coeffI]] - X[L[coeffI]]); + } + } + } + else + { + // Note: pointer looping + const label* const __restrict__ U = lduAddr().upperAddr().begin(); + const label* const __restrict__ L = lduAddr().lowerAddr().begin(); + + const scalar* const __restrict__ Lower = lower().begin(); + const scalar* const __restrict__ Upper = upper().begin(); + const scalar* const __restrict__ X = x.begin(); + + scalar* __restrict__ R = result.begin(); + + for (register label coeffI = 0; coeffI < upper().size(); coeffI++) + { + R[coeffI] = Upper[coeffI]*X[U[coeffI]] - Lower[coeffI]*X[L[coeffI]]; + } } } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.C index a641a4541..69bb9af48 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.C @@ -69,4 +69,12 @@ void Foam::ggiLduInterfaceField::transformCoupleField } +template<> +void Foam::ggiLduInterfaceField::transformCoupleField +( + scalarField& pnf +) const +{} + + // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.H index 32a2a91c9..261b91168 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.H @@ -95,8 +95,24 @@ public: scalarField& psiInternal, const direction cmpt ) const; + + + //- Transform given patch internal field + template + void transformCoupleField + ( + Field& psiInternal + ) const; }; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Transform given patch internal field +template<> +void ggiLduInterfaceField::transformCoupleField +( + scalarField& psiInternal +) const; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -104,6 +120,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "ggiLduInterfaceFieldTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.C index 82e25336d..8b5219afc 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.C @@ -277,6 +277,35 @@ void cyclicGgiFvPatchField::updateInterfaceMatrix {} +template +void cyclicGgiFvPatchField::initInterfaceMatrixUpdate +( + const Field& psiInternal, + Field& result, + const BlockLduMatrix& m, + const CoeffField& coeffs, + const Pstream::commsTypes commsType +) const +{ + notImplemented("void cyclicGgiFvPatchField::initInterfaceMatrixUpdate" + " for block-coupled matrices of tensor types" + ) +} + + +template +void cyclicGgiFvPatchField::updateInterfaceMatrix +( + const Field&, + Field&, + const BlockLduMatrix&, + const CoeffField&, + const Pstream::commsTypes commsType +) const +{ +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.H index bdd2db62c..c8b3fd6f4 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchField.H @@ -169,7 +169,26 @@ public: const Pstream::commsTypes commsType ) const; + //- Initialise neighbour matrix update + virtual void initInterfaceMatrixUpdate + ( + const Field& psiInternal, + Field& result, + const BlockLduMatrix& m, + const CoeffField& coeffs, + const Pstream::commsTypes commsType + ) const; + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + const Field&, + Field&, + const BlockLduMatrix&, + const CoeffField&, + const Pstream::commsTypes commsType + ) const; + //- GGI coupled interface functions //- Does the patch field perform the transfromation diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.C index 37cf372c4..6f6b8105d 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.C @@ -37,12 +37,109 @@ Contributor: #include "cyclicGgiFvPatchFields.H" #include "addToRunTimeSelectionTable.H" #include "volFields.H" +#include "scalarCoeffField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<> +void cyclicGgiFvPatchField::initInterfaceMatrixUpdate +( + const Field& psiInternal, + Field& result, + const BlockLduMatrix& m, + const CoeffField& coeffs, + const Pstream::commsTypes commsType +) const +{ + // Communication is allowed either before or after processor + // patch comms. HJ, 11/Jul/2011 + + // Get shadow face-cells and assemble shadow field + const unallocLabelList& sfc = cyclicGgiPatch_.shadow().faceCells(); + + scalarField sField(sfc.size()); + + forAll (sField, i) + { + sField[i] = psiInternal[sfc[i]]; + } + + // Note: scalar interpolate does not get a transform, so this is safe + // HJ, 12/Jan/2009 + scalarField pnf = cyclicGgiPatch_.interpolate(sField); + + // Multiply the field by coefficients and add into the result + const unallocLabelList& fc = cyclicGgiPatch_.faceCells(); + + forAll(fc, elemI) + { + result[fc[elemI]] -= coeffs[elemI]*pnf[elemI]; + }; +} + + +template<> +void cyclicGgiFvPatchField::initInterfaceMatrixUpdate +( + const Field& psiInternal, + Field& result, + const BlockLduMatrix& m, + const CoeffField& coeffs, + const Pstream::commsTypes commsType +) const +{ + // Communication is allowed either before or after processor + // patch comms. HJ, 11/Jul/2011 + + // Get shadow face-cells and assemble shadow field + const unallocLabelList& sfc = cyclicGgiPatch_.shadow().faceCells(); + + Field sField(sfc.size()); + + forAll (sField, i) + { + sField[i] = psiInternal[sfc[i]]; + } + + // Transform according to the transformation tensor, using the slave + // side transform. Warning: forwardT() corresponds to the slave + // patch. HJ, 12/Jan/2009 + transformCoupleField(sField); + + // Note: scalar interpolate does not get a transform, so this is safe + // HJ, 12/Jan/2009 + // TODO - IC, Is this safe for vectors? + Field pnf = cyclicGgiPatch_.interpolate(sField); + + if (coeffs.activeType() == blockCoeffBase::SCALAR) + { + pnf = coeffs.asScalar() * pnf; + } + else if (coeffs.activeType() == blockCoeffBase::LINEAR) + { + pnf = cmptMultiply(coeffs.asLinear(), pnf); + } + else if (coeffs.activeType() == blockCoeffBase::SQUARE) + { + pnf = coeffs.asSquare() & pnf; + } + + // Multiply the field by coefficients and add into the result + const unallocLabelList& fc = cyclicGgiPatch_.faceCells(); + + // Multiply the field by coefficients and add into the result + forAll(fc, elemI) + { + result[fc[elemI]] -= pnf[elemI]; + } +} + + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // makePatchFields(cyclicGgi); diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.H index bd4c18e7f..a4759a6d6 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.H @@ -51,6 +51,30 @@ SourceFiles namespace Foam { +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<> +void cyclicGgiFvPatchField::initInterfaceMatrixUpdate +( + const Field& psiInternal, + Field& result, + const BlockLduMatrix& m, + const CoeffField& coeffs, + const Pstream::commsTypes commsType +) const; + + +template<> +void cyclicGgiFvPatchField::initInterfaceMatrixUpdate +( + const Field& psiInternal, + Field& result, + const BlockLduMatrix& m, + const CoeffField& coeffs, + const Pstream::commsTypes commsType +) const; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // makePatchTypeFieldTypedefs(cyclicGgi) From d0a6150dc3443c5a6e238c60ad8b27a028f69d04 Mon Sep 17 00:00:00 2001 From: Ivor Clifford Date: Mon, 24 Oct 2011 13:26:58 -0600 Subject: [PATCH 3/6] Fixed GGI transform --- .../ggiLduInterfaceField.H | 22 ------------------- .../constraint/cyclicGgi/cyclicGgiPolyPatch.C | 2 +- .../constraint/cyclicGgi/cyclicGgiPolyPatch.H | 2 +- .../polyPatches/constraint/ggi/ggiPolyPatch.C | 2 +- .../polyPatches/constraint/ggi/ggiPolyPatch.H | 2 +- .../cyclicGgi/cyclicGgiFvPatchFields.C | 9 +------- 6 files changed, 5 insertions(+), 34 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.H index 261b91168..32a2a91c9 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.H @@ -95,24 +95,8 @@ public: scalarField& psiInternal, const direction cmpt ) const; - - - //- Transform given patch internal field - template - void transformCoupleField - ( - Field& psiInternal - ) const; }; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -//- Transform given patch internal field -template<> -void ggiLduInterfaceField::transformCoupleField -( - scalarField& psiInternal -) const; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -120,12 +104,6 @@ void ggiLduInterfaceField::transformCoupleField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "ggiLduInterfaceFieldTemplates.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicGgi/cyclicGgiPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicGgi/cyclicGgiPolyPatch.C index aebb0d6c1..74d0a2717 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicGgi/cyclicGgiPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicGgi/cyclicGgiPolyPatch.C @@ -241,7 +241,7 @@ const Foam::cyclicGgiPolyPatch& Foam::cyclicGgiPolyPatch::cyclicShadow() const } -void Foam::cyclicGgiPolyPatch::calcTransforms() +void Foam::cyclicGgiPolyPatch::calcTransforms() const { if (active() && debug) { diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicGgi/cyclicGgiPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicGgi/cyclicGgiPolyPatch.H index 48034ea98..f686557b2 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicGgi/cyclicGgiPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicGgi/cyclicGgiPolyPatch.H @@ -75,7 +75,7 @@ class cyclicGgiPolyPatch //- Calculate cyclic transforms (rotation and translation) // Virtual over-ride for base GGI patch. HJ, 14/Jan/2009 - virtual void calcTransforms(); + virtual void calcTransforms() const; //- Check definition: angles and offsets void checkDefinition() const; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C index 664dffd09..f6298e540 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.C @@ -859,7 +859,7 @@ void Foam::ggiPolyPatch::updateMesh() } -void Foam::ggiPolyPatch::calcTransforms() +void Foam::ggiPolyPatch::calcTransforms() const { // Simplest GGI: no transform or separation. HJ, 24/Oct/2008 forwardT_.setSize(0); diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.H index c96f41df6..e3e7b5685 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatch.H @@ -127,7 +127,7 @@ class ggiPolyPatch void calcReconFaceCellCentres() const; //- Force calculation of transformation tensors - virtual void calcTransforms(); + virtual void calcTransforms() const; // Parallel communication optimisation, stored on master processor diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.C index 6f6b8105d..8bb29e950 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicGgi/cyclicGgiFvPatchFields.C @@ -106,14 +106,7 @@ void cyclicGgiFvPatchField::initInterfaceMatrixUpdate sField[i] = psiInternal[sfc[i]]; } - // Transform according to the transformation tensor, using the slave - // side transform. Warning: forwardT() corresponds to the slave - // patch. HJ, 12/Jan/2009 - transformCoupleField(sField); - - // Note: scalar interpolate does not get a transform, so this is safe - // HJ, 12/Jan/2009 - // TODO - IC, Is this safe for vectors? + // Transformation is handled in interpolation. HJ, 7/Jan/2009 Field pnf = cyclicGgiPatch_.interpolate(sField); if (coeffs.activeType() == blockCoeffBase::SCALAR) From 88ab04e2c8aad484b15ebb5f1173a6813c0156db Mon Sep 17 00:00:00 2001 From: Ivor Clifford Date: Mon, 24 Oct 2011 13:47:22 -0600 Subject: [PATCH 4/6] Bugfix --- .../ggiLduInterfaceField/ggiLduInterfaceField.C | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.C index 69bb9af48..198a62da4 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/ggiLduInterfaceField/ggiLduInterfaceField.C @@ -69,12 +69,5 @@ void Foam::ggiLduInterfaceField::transformCoupleField } -template<> -void Foam::ggiLduInterfaceField::transformCoupleField -( - scalarField& pnf -) const -{} - // ************************************************************************* // From 437e75704cf2b2ca4d645886a4e081cdbad63f6a Mon Sep 17 00:00:00 2001 From: Martin Beaudoin Date: Fri, 31 May 2013 00:31:18 -0400 Subject: [PATCH 5/6] .gitignore: blacklisting files subject to a DMCA complaint by ANSYS --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index b6d81a490..013e5460d 100644 --- a/.gitignore +++ b/.gitignore @@ -86,4 +86,12 @@ etc/settings.csh etc/setteings.sh +# The following files are blacklisted because of a DMCA complaint by ANSYS. +src/lduSolvers/tools/PriorityArray.C +src/lduSolvers/tools/PriorityArray.H +src/lduSolvers/amg/amgPolicy/samgPolicy.C +src/lduSolvers/amg/amgPolicy/samgPolicy.H +src/lduSolvers/amg/amgPolicy/aamgPolicy.C +src/lduSolvers/amg/amgPolicy/aamgPolicy.H + # end-of-file From 3d4501e5383d226bd9c3f5aa243ef00cfd359ca9 Mon Sep 17 00:00:00 2001 From: Martin Beaudoin Date: Sun, 2 Jun 2013 09:11:26 -0400 Subject: [PATCH 6/6] Fixing compilation of lduSolvers following removal of files --- src/lduSolvers/Make/files | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lduSolvers/Make/files b/src/lduSolvers/Make/files index ab36ce6b1..7d891ced3 100644 --- a/src/lduSolvers/Make/files +++ b/src/lduSolvers/Make/files @@ -30,7 +30,5 @@ $(amg)/coarseAmgLevel.C amgPolicy = $(amg)/amgPolicy $(amgPolicy)/amgPolicy.C $(amgPolicy)/pamgPolicy.C -$(amgPolicy)/aamgPolicy.C -$(amgPolicy)/samgPolicy.C LIB = $(FOAM_LIBBIN)/liblduSolvers