diff --git a/src/AMIInterpolation/Make/files b/src/AMIInterpolation/Make/files
index 76d2ff7f43..7a47cad93c 100644
--- a/src/AMIInterpolation/Make/files
+++ b/src/AMIInterpolation/Make/files
@@ -1,4 +1,12 @@
AMIInterpolationName.C
faceAreaIntersect/faceAreaIntersect.C
+patches/cyclicAMILduInterfaceField/cyclicAMILduInterface.C
+patches/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C
+
+patches/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
+patches/cyclicAMIFvPatch/cyclicAMIFvPatch.C
+patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFields.C
+patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFields.C
+
LIB = $(FOAM_USER_LIBBIN)/libAMIInterpolation
diff --git a/src/AMIInterpolation/Make/options b/src/AMIInterpolation/Make/options
index 1b3eff5f59..431de9fbf4 100644
--- a/src/AMIInterpolation/Make/options
+++ b/src/AMIInterpolation/Make/options
@@ -1,6 +1,8 @@
EXE_INC = \
-DFULLDEBUG -g -O0 \
+ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
+ -lfiniteVolume \
-lmeshTools
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvPatch/cyclicAMIFvPatch.C b/src/AMIInterpolation/patches/cyclicAMIFvPatch/cyclicAMIFvPatch.C
new file mode 100644
index 0000000000..d000c52c31
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvPatch/cyclicAMIFvPatch.C
@@ -0,0 +1,143 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "cyclicAMIFvPatch.H"
+#include "addToRunTimeSelectionTable.H"
+#include "fvMesh.H"
+#include "transform.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug(cyclicAMIFvPatch, 0);
+ addToRunTimeSelectionTable(fvPatch, cyclicAMIFvPatch, polyPatch);
+}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
+{
+ const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
+
+ const scalarField deltas(nf() & fvPatch::delta());
+
+ const scalarField nbrDeltas
+ (
+ interpolateToSource(nbrPatch.nf() & nbrPatchDelta())
+ );
+
+ forAll(deltas, faceI)
+ {
+ scalar di = deltas[faceI];
+ scalar dni = nbrDeltas[faceI];
+
+ w[faceI] = dni/(di + dni);
+ }
+}
+
+
+void Foam::cyclicAMIFvPatch::makeDeltaCoeffs(scalarField& dc) const
+{
+ const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
+
+ const scalarField deltas(nf() & fvPatch::delta());
+
+ const scalarField nbrDeltas
+ (
+ interpolateToSource(nbrPatch.nf() & nbrPatchDelta())
+ );
+
+ forAll(deltas, faceI)
+ {
+ scalar di = deltas[faceI];
+ scalar dni = nbrDeltas[faceI];
+
+ dc[faceI] = 1.0/(di + dni);
+ }
+}
+
+
+Foam::tmp Foam::cyclicAMIFvPatch::delta() const
+{
+ const vectorField patchD(fvPatch::delta());
+
+ const vectorField& nbrPatchD(interpolateToSource(nbrPatchDelta()));
+
+ tmp tpdv(new vectorField(patchD.size()));
+ vectorField& pdv = tpdv();
+
+ // To the transformation if necessary
+ if (parallel())
+ {
+ forAll(patchD, faceI)
+ {
+ vector ddi = patchD[faceI];
+ vector dni = nbrPatchD[faceI];
+
+ pdv[faceI] = ddi - dni;
+ }
+ }
+ else
+ {
+ forAll(patchD, faceI)
+ {
+ vector ddi = patchD[faceI];
+ vector dni = nbrPatchD[faceI];
+
+ pdv[faceI] = ddi - transform(forwardT()[0], dni);
+ }
+ }
+
+ return tpdv;
+}
+
+
+Foam::tmp Foam::cyclicAMIFvPatch::interfaceInternalField
+(
+ const labelUList& internalData
+) const
+{
+ return patchInternalField(internalData);
+}
+
+
+Foam::tmp Foam::cyclicAMIFvPatch::internalFieldTransfer
+(
+ const Pstream::commsTypes commsType,
+ const labelUList& iF
+) const
+{
+ tmp tnpif(neighbFvPatch().patchInternalField(iF));
+ labelField& npif = tnpif();
+
+ interpolateToSource(npif);
+
+ return tnpif;
+}
+
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvPatch/cyclicAMIFvPatch.H b/src/AMIInterpolation/patches/cyclicAMIFvPatch/cyclicAMIFvPatch.H
new file mode 100644
index 0000000000..5ccdd01d89
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvPatch/cyclicAMIFvPatch.H
@@ -0,0 +1,193 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::cyclicAMIFvPatch
+
+Description
+ Cyclic patch for Arbitrary Mesh Interface (AMI)
+
+SourceFiles
+ cyclicAMIFvPatch.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMIFvPatch_H
+#define cyclicAMIFvPatch_H
+
+#include "coupledFvPatch.H"
+#include "cyclicAMILduInterface.H"
+#include "cyclicAMIPolyPatch.H"
+#include "fvBoundaryMesh.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class cyclicAMIFvPatch Declaration
+\*---------------------------------------------------------------------------*/
+
+class cyclicAMIFvPatch
+:
+ public coupledFvPatch,
+ public cyclicAMILduInterface
+{
+ // Private data
+
+ const cyclicAMIPolyPatch& cyclicAMIPolyPatch_;
+
+
+protected:
+
+ // Protected Member functions
+
+ //- Make patch weighting factors
+ void makeWeights(scalarField&) const;
+
+ //- Make patch face - neighbour cell distances
+ void makeDeltaCoeffs(scalarField&) const;
+
+
+public:
+
+ //- Runtime type information
+ TypeName(cyclicAMIPolyPatch::typeName_());
+
+
+ // Constructors
+
+ //- Construct from polyPatch
+ cyclicAMIFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
+ :
+ coupledFvPatch(patch, bm),
+ cyclicAMILduInterface(),
+ cyclicAMIPolyPatch_(refCast(patch))
+ {}
+
+
+ // Member functions
+
+ // Access
+
+ //- Return local reference cast into the cyclic patch
+ const cyclicAMIPolyPatch& cyclicAMIPatch() const
+ {
+ return cyclicAMIPolyPatch_;
+ }
+
+ //- Return neighbour
+ virtual label neighbPatchID() const
+ {
+ return cyclicAMIPolyPatch_.nbrPatchID();
+ }
+
+ virtual bool owner() const
+ {
+ return cyclicAMIPolyPatch_.owner();
+ }
+
+ //- Return processor number
+ virtual const cyclicAMIFvPatch& neighbPatch() const
+ {
+ return refCast
+ (
+ this->boundaryMesh()[cyclicAMIPolyPatch_.nbrPatchID()]
+ );
+ }
+
+ //- Are the cyclic planes parallel
+ virtual bool parallel() const
+ {
+ return cyclicAMIPolyPatch_.parallel();
+ }
+
+ //- Return face transformation tensor
+ virtual const tensorField& forwardT() const
+ {
+ return cyclicAMIPolyPatch_.forwardT();
+ }
+
+ //- Return neighbour-cell transformation tensor
+ virtual const tensorField& reverseT() const
+ {
+ return cyclicAMIPolyPatch_.reverseT();
+ }
+
+ const cyclicAMIFvPatch& neighbFvPatch() const
+ {
+ return refCast
+ (
+ this->boundaryMesh()[cyclicAMIPolyPatch_.nbrPatchID()]
+ );
+ }
+
+ //- Return delta (P to N) vectors across coupled patch
+ virtual tmp delta() const;
+
+ template
+ tmp > interpolateToSource(const Field& fld) const
+ {
+ return cyclicAMIPolyPatch_.interpolateToSource(fld);
+ }
+
+ template
+ tmp > interpolateToSource(const tmp >& tFld) const
+ {
+ return cyclicAMIPolyPatch_.interpolateToSource(tFld);
+ }
+
+ const vectorField& nbrPatchDelta() const
+ {
+ return cyclicAMIPolyPatch_.nbrPatchDelta();
+ }
+
+
+ // Interface transfer functions
+
+ //- Return the values of the given internal data adjacent to
+ // the interface as a field
+ virtual tmp interfaceInternalField
+ (
+ const labelUList& internalData
+ ) const;
+
+ //- Return neighbour field
+ virtual tmp internalFieldTransfer
+ (
+ const Pstream::commsTypes commsType,
+ const labelUList& internalData
+ ) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchField.C b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchField.C
new file mode 100644
index 0000000000..6014ef8b90
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchField.C
@@ -0,0 +1,234 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "cyclicAMIFvPatchField.H"
+#include "transformField.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template
+Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ cyclicAMILduInterfaceField(),
+ coupledFvPatchField(p, iF),
+ cyclicAMIPatch_(refCast(p))
+{}
+
+
+template
+Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField
+(
+ const cyclicAMIFvPatchField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ cyclicAMILduInterfaceField(),
+ coupledFvPatchField(ptf, p, iF, mapper),
+ cyclicAMIPatch_(refCast(p))
+{
+ if (!isA(this->patch()))
+ {
+ FatalErrorIn
+ (
+ "cyclicAMIFvPatchField::cyclicAMIFvPatchField"
+ "("
+ "const cyclicAMIFvPatchField& ,"
+ "const fvPatch&, "
+ "const DimensionedField&, "
+ "const fvPatchFieldMapper&"
+ ")"
+ ) << " patch type '" << p.type()
+ << "' not constraint type '" << typeName << "'"
+ << "\n for patch " << p.name()
+ << " of field " << this->dimensionedInternalField().name()
+ << " in file " << this->dimensionedInternalField().objectPath()
+ << exit(FatalIOError);
+ }
+}
+
+
+template
+Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ cyclicAMILduInterfaceField(),
+ coupledFvPatchField(p, iF, dict),
+ cyclicAMIPatch_(refCast(p))
+{
+ if (!isA(p))
+ {
+ FatalIOErrorIn
+ (
+ "cyclicAMIFvPatchField::cyclicAMIFvPatchField"
+ "("
+ "const fvPatch&, "
+ "const Field&, "
+ "const dictionary&"
+ ")",
+ dict
+ ) << " patch type '" << p.type()
+ << "' not constraint type '" << typeName << "'"
+ << "\n for patch " << p.name()
+ << " of field " << this->dimensionedInternalField().name()
+ << " in file " << this->dimensionedInternalField().objectPath()
+ << exit(FatalIOError);
+ }
+
+ this->evaluate(Pstream::blocking);
+}
+
+
+template
+Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField
+(
+ const cyclicAMIFvPatchField& ptf
+)
+:
+ cyclicAMILduInterfaceField(),
+ coupledFvPatchField(ptf),
+ cyclicAMIPatch_(ptf.cyclicAMIPatch_)
+{}
+
+
+template
+Foam::cyclicAMIFvPatchField::cyclicAMIFvPatchField
+(
+ const cyclicAMIFvPatchField& ptf,
+ const DimensionedField& iF
+)
+:
+ cyclicAMILduInterfaceField(),
+ coupledFvPatchField(ptf, iF),
+ cyclicAMIPatch_(ptf.cyclicAMIPatch_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+Foam::tmp >
+Foam::cyclicAMIFvPatchField::patchNeighbourField() const
+{
+ const Field& iField = this->internalField();
+ const labelUList& nbrFaceCells =
+ cyclicAMIPatch_.cyclicAMIPatch().nbrPatch().faceCells();
+
+ tmp > tpnf(new Field(nbrFaceCells.size()));
+ Field& pnf = tpnf();
+
+
+ if (doTransform())
+ {
+ forAll(pnf, faceI)
+ {
+ pnf[faceI] = transform
+ (
+ forwardT()[0], iField[nbrFaceCells[faceI]]
+ );
+ }
+ }
+ else
+ {
+ forAll(pnf, faceI)
+ {
+ pnf[faceI] = iField[nbrFaceCells[faceI]];
+ }
+ }
+
+ return cyclicAMIPatch_.interpolateToSource(pnf);
+}
+
+
+template
+const Foam::cyclicAMIFvPatchField&
+Foam::cyclicAMIFvPatchField::neighbourPatchField() const
+{
+ const GeometricField& fld =
+ static_cast&>
+ (
+ this->internalField()
+ );
+
+ return refCast >
+ (
+ fld.boundaryField()[cyclicAMIPatch_.neighbPatchID()]
+ );
+}
+
+
+template
+void Foam::cyclicAMIFvPatchField::updateInterfaceMatrix
+(
+ const scalarField& psiInternal,
+ scalarField& result,
+ const lduMatrix&,
+ const scalarField& coeffs,
+ const direction cmpt,
+ const Pstream::commsTypes
+) const
+{
+ const labelUList& nbrFaceCells =
+ cyclicAMIPatch_.cyclicAMIPatch().nbrPatch().faceCells();
+
+ scalarField pnf(nbrFaceCells.size());
+
+ forAll(pnf, faceI)
+ {
+ pnf[faceI] = psiInternal[nbrFaceCells[faceI]];
+ }
+
+ // Transform according to the transformation tensors
+ transformCoupleField(pnf, cmpt);
+
+ pnf = cyclicAMIPatch_.interpolateToSource(pnf);
+
+ // Multiply the field by coefficients and add into the result
+ const labelUList& faceCells = cyclicAMIPatch_.faceCells();
+
+ forAll(faceCells, elemI)
+ {
+ result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
+ }
+}
+
+
+template
+void Foam::cyclicAMIFvPatchField::write(Ostream& os) const
+{
+ fvPatchField::write(os);
+}
+
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchField.H b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchField.H
new file mode 100644
index 0000000000..b4a14380a3
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchField.H
@@ -0,0 +1,216 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::cyclicAMIFvPatchField
+
+Description
+ Foam::cyclicAMIFvPatchField
+
+SourceFiles
+ cyclicAMIFvPatchField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMIFvPatchField_H
+#define cyclicAMIFvPatchField_H
+
+#include "coupledFvPatchField.H"
+#include "cyclicAMILduInterfaceField.H"
+#include "cyclicAMIFvPatch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class cyclicAMIFvPatchField Declaration
+\*---------------------------------------------------------------------------*/
+
+template
+class cyclicAMIFvPatchField
+:
+ virtual public cyclicAMILduInterfaceField,
+ public coupledFvPatchField
+{
+ // Private data
+
+ //- Local reference cast into the cyclic patch
+ const cyclicAMIFvPatch& cyclicAMIPatch_;
+
+
+ // Private Member Functions
+
+ //- Return neighbour side field given internal fields
+ template
+ tmp > neighbourSideField
+ (
+ const Field&
+ ) const;
+
+
+public:
+
+ //- Runtime type information
+ TypeName(cyclicAMIFvPatch::typeName_());
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ cyclicAMIFvPatchField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ cyclicAMIFvPatchField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given cyclicAMIFvPatchField onto a new patch
+ cyclicAMIFvPatchField
+ (
+ const cyclicAMIFvPatchField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct as copy
+ cyclicAMIFvPatchField(const cyclicAMIFvPatchField&);
+
+ //- Construct and return a clone
+ virtual tmp > clone() const
+ {
+ return tmp >
+ (
+ new cyclicAMIFvPatchField(*this)
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ cyclicAMIFvPatchField
+ (
+ const cyclicAMIFvPatchField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp > clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp >
+ (
+ new cyclicAMIFvPatchField(*this, iF)
+ );
+ }
+
+
+ // Member functions
+
+ // Access
+
+ //- Return local reference cast into the cyclic AMI patch
+ const cyclicAMIFvPatch& cyclicAMIPatch() const
+ {
+ return cyclicAMIPatch_;
+ }
+
+
+ // Evaluation functions
+
+ //- Return neighbour coupled internal cell data
+ tmp > patchNeighbourField() const;
+
+ //- Return reference to neighbour patchField
+ const cyclicAMIFvPatchField& neighbourPatchField() const;
+
+ //- Update result field based on interface functionality
+ virtual void updateInterfaceMatrix
+ (
+ const scalarField& psiInternal,
+ scalarField& result,
+ const lduMatrix&,
+ const scalarField& coeffs,
+ const direction cmpt,
+ const Pstream::commsTypes commsType
+ ) const;
+
+
+ // Cyclic AMI coupled interface functions
+
+ //- Does the patch field perform the transformation
+ virtual bool doTransform() const
+ {
+ return !(cyclicAMIPatch_.parallel() || pTraits::rank == 0);
+ }
+
+ //- Return face transformation tensor
+ virtual const tensorField& forwardT() const
+ {
+ return cyclicAMIPatch_.forwardT();
+ }
+
+ //- Return neighbour-cell transformation tensor
+ virtual const tensorField& reverseT() const
+ {
+ return cyclicAMIPatch_.reverseT();
+ }
+
+ //- Return rank of component for transform
+ virtual int rank() const
+ {
+ return pTraits::rank;
+ }
+
+
+ // I-O
+
+ //- Write
+ virtual void write(Ostream& os) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+# include "cyclicAMIFvPatchField.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFields.C b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFields.C
new file mode 100644
index 0000000000..2bd5752dee
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFields.C
@@ -0,0 +1,43 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "cyclicAMIFvPatchFields.H"
+#include "addToRunTimeSelectionTable.H"
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+makePatchFields(cyclicAMI);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFields.H b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFields.H
new file mode 100644
index 0000000000..7fd67d201b
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFields.H
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMIFvPatchFields_H
+#define cyclicAMIFvPatchFields_H
+
+#include "cyclicAMIFvPatchField.H"
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makePatchTypeFieldTypedefs(cyclicAMI);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFieldsFwd.H b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFieldsFwd.H
new file mode 100644
index 0000000000..6f6a207070
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvPatchField/cyclicAMIFvPatchFieldsFwd.H
@@ -0,0 +1,50 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMIFvPatchFieldsFwd_H
+#define cyclicAMIFvPatchFieldsFwd_H
+
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template class cyclicAMIFvPatchField;
+
+makePatchTypeFieldTypedefs(cyclicAMI);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchField.C b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchField.C
new file mode 100644
index 0000000000..9a197c01e7
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchField.C
@@ -0,0 +1,126 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "cyclicAMIFvsPatchField.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+template
+Foam::cyclicAMIFvsPatchField::cyclicAMIFvsPatchField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ coupledFvsPatchField(p, iF),
+ cyclicAMIPatch_(refCast(p))
+{}
+
+
+template
+Foam::cyclicAMIFvsPatchField::cyclicAMIFvsPatchField
+(
+ const cyclicAMIFvsPatchField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ coupledFvsPatchField(ptf, p, iF, mapper),
+ cyclicAMIPatch_(refCast(p))
+{
+ if (!isA(this->patch()))
+ {
+ FatalErrorIn
+ (
+ "cyclicAMIFvsPatchField::cyclicAMIFvsPatchField\n"
+ "("
+ "const cyclicAMIFvsPatchField&, "
+ "const fvPatch&, "
+ "const DimensionedField&, "
+ "const fvPatchFieldMapper&"
+ ")"
+ ) << "Field type does not correspond to patch type for patch "
+ << this->patch().index() << "." << endl
+ << "Field type: " << typeName << endl
+ << "Patch type: " << this->patch().type()
+ << exit(FatalError);
+ }
+}
+
+
+template
+Foam::cyclicAMIFvsPatchField::cyclicAMIFvsPatchField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ coupledFvsPatchField(p, iF, dict),
+ cyclicAMIPatch_(refCast(p))
+{
+ if (!isA(p))
+ {
+ FatalIOErrorIn
+ (
+ "cyclicAMIFvsPatchField::cyclicAMIFvsPatchField"
+ "("
+ "const fvPatch&, "
+ "const Field&, "
+ "const dictionary&"
+ ")",
+ dict
+ ) << "patch " << this->patch().index() << " not cyclicAMI type. "
+ << "Patch type = " << p.type()
+ << exit(FatalIOError);
+ }
+}
+
+
+template
+Foam::cyclicAMIFvsPatchField::cyclicAMIFvsPatchField
+(
+ const cyclicAMIFvsPatchField& ptf
+)
+:
+ coupledFvsPatchField(ptf),
+ cyclicAMIPatch_(ptf.cyclicAMIPatch_)
+{}
+
+
+template
+Foam::cyclicAMIFvsPatchField::cyclicAMIFvsPatchField
+(
+ const cyclicAMIFvsPatchField& ptf,
+ const DimensionedField& iF
+)
+:
+ coupledFvsPatchField(ptf, iF),
+ cyclicAMIPatch_(ptf.cyclicAMIPatch_)
+{}
+
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchField.H b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchField.H
new file mode 100644
index 0000000000..01fd762f4f
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchField.H
@@ -0,0 +1,143 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::cyclicAMIFvsPatchField
+
+Description
+ Foam::cyclicAMIFvsPatchField
+
+SourceFiles
+ cyclicAMIFvsPatchField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMIFvsPatchField_H
+#define cyclicAMIFvsPatchField_H
+
+#include "coupledFvsPatchField.H"
+#include "cyclicAMIFvPatch.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class cyclicAMIFvsPatchField Declaration
+\*---------------------------------------------------------------------------*/
+
+template
+class cyclicAMIFvsPatchField
+:
+ public coupledFvsPatchField
+{
+ // Private data
+
+ //- Local reference cast into the cyclic patch
+ const cyclicAMIFvPatch& cyclicAMIPatch_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName(cyclicAMIFvPatch::typeName_());
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ cyclicAMIFvsPatchField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ cyclicAMIFvsPatchField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given cyclicAMIFvsPatchField onto a new patch
+ cyclicAMIFvsPatchField
+ (
+ const cyclicAMIFvsPatchField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct as copy
+ cyclicAMIFvsPatchField
+ (
+ const cyclicAMIFvsPatchField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp > clone() const
+ {
+ return tmp >
+ (
+ new cyclicAMIFvsPatchField(*this)
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ cyclicAMIFvsPatchField
+ (
+ const cyclicAMIFvsPatchField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp > clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp >
+ (
+ new cyclicAMIFvsPatchField(*this, iF)
+ );
+ }
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+# include "cyclicAMIFvsPatchField.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFields.C b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFields.C
new file mode 100644
index 0000000000..a439f7f83a
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFields.C
@@ -0,0 +1,43 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "cyclicAMIFvsPatchFields.H"
+#include "fvsPatchFields.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+makeFvsPatchFields(cyclicAMI);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFields.H b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFields.H
new file mode 100644
index 0000000000..18021d6e17
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFields.H
@@ -0,0 +1,49 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMIFvsPatchFields_H
+#define cyclicAMIFvsPatchFields_H
+
+#include "cyclicAMIFvsPatchField.H"
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makeFvsPatchTypeFieldTypedefs(cyclicAMI);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFieldsFwd.H b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFieldsFwd.H
new file mode 100644
index 0000000000..72fdc4d4ce
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFieldsFwd.H
@@ -0,0 +1,50 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMIFvsPatchFieldsFwd_H
+#define cyclicAMIFvsPatchFieldsFwd_H
+
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template class cyclicAMIFvsPatchField;
+
+makeFvsPatchTypeFieldTypedefs(cyclicAMI);
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterface.C b/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterface.C
new file mode 100644
index 0000000000..70eaba2fd4
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterface.C
@@ -0,0 +1,39 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "cyclicAMILduInterface.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(Foam::cyclicAMILduInterface, 0);
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+Foam::cyclicAMILduInterface::~cyclicAMILduInterface()
+{}
+
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterface.H b/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterface.H
new file mode 100644
index 0000000000..67016cb4be
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterface.H
@@ -0,0 +1,97 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::cyclicAMILduInterface
+
+Description
+ An abstract base class for cyclic AMI coupled interfaces
+
+SourceFiles
+ cyclicAMILduInterface.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMILduInterface_H
+#define cyclicAMILduInterface_H
+
+#include "primitiveFieldsFwd.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class cyclicAMILduInterface Declaration
+\*---------------------------------------------------------------------------*/
+
+class cyclicAMILduInterface
+{
+
+public:
+
+ //- Runtime type information
+ TypeName("cyclicAMILduInterface");
+
+
+ // Constructors
+
+ //- Construct null
+ cyclicAMILduInterface()
+ {}
+
+
+ //- Destructor
+ virtual ~cyclicAMILduInterface();
+
+
+ // Member Functions
+
+ // Access
+
+ //- Return neighbour
+ virtual label neighbPatchID() const = 0;
+
+ virtual bool owner() const = 0;
+
+ //- Return processor number
+ virtual const cyclicAMILduInterface& neighbPatch() const = 0;
+
+ //- Return face transformation tensor
+ virtual const tensorField& forwardT() const = 0;
+
+ //- Return face reverse transformation tensor
+ virtual const tensorField& reverseT() const = 0;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C b/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C
new file mode 100644
index 0000000000..fa9b5a772d
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C
@@ -0,0 +1,62 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "cyclicAMILduInterfaceField.H"
+#include "diagTensorField.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(Foam::cyclicAMILduInterfaceField, 0);
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+Foam::cyclicAMILduInterfaceField::~cyclicAMILduInterfaceField()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::cyclicAMILduInterfaceField::transformCoupleField
+(
+ scalarField& f,
+ const direction cmpt
+) const
+{
+ if (doTransform())
+ {
+ if (forwardT().size() == 1)
+ {
+ f *= pow(diag(forwardT()[0]).component(cmpt), rank());
+ }
+ else
+ {
+ f *= pow(diag(forwardT())().component(cmpt), rank());
+ }
+ }
+}
+
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H b/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H
new file mode 100644
index 0000000000..29173e3fab
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.H
@@ -0,0 +1,103 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::cyclicAMILduInterfaceField
+
+Description
+ Abstract base class for cyclic AMI coupled interfaces
+
+SourceFiles
+ cyclicAMILduInterfaceField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMILduInterfaceField_H
+#define cyclicAMILduInterfaceField_H
+
+#include "primitiveFieldsFwd.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class cyclicAMILduInterfaceField Declaration
+\*---------------------------------------------------------------------------*/
+
+class cyclicAMILduInterfaceField
+{
+
+public:
+
+ //- Runtime type information
+ TypeName("cyclicAMILduInterfaceField");
+
+
+ // Constructors
+
+ //- Construct null
+ cyclicAMILduInterfaceField()
+ {}
+
+
+ //- Destructor
+ virtual ~cyclicAMILduInterfaceField();
+
+
+ // Member Functions
+
+ // Access
+
+ //- Is the transform required
+ virtual bool doTransform() const = 0;
+
+ //- Return face transformation tensor
+ virtual const tensorField& forwardT() const = 0;
+
+ //- Return neighbour-cell transformation tensor
+ virtual const tensorField& reverseT() const = 0;
+
+ //- Return rank of component for transform
+ virtual int rank() const = 0;
+
+
+ //- Transform given patch internal field
+ void transformCoupleField
+ (
+ scalarField& psiInternal,
+ const direction cmpt
+ ) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/AMIInterpolation/patches/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
new file mode 100644
index 0000000000..7ae69325b7
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
@@ -0,0 +1,754 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "cyclicAMIPolyPatch.H"
+#include "transformField.H"
+#include "SubField.H"
+#include "polyMesh.H"
+#include "Time.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ defineTypeNameAndDebug(cyclicAMIPolyPatch, 0);
+
+ addToRunTimeSelectionTable(polyPatch, cyclicAMIPolyPatch, word);
+ addToRunTimeSelectionTable(polyPatch, cyclicAMIPolyPatch, dictionary);
+}
+
+
+// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
+
+Foam::label Foam::cyclicAMIPolyPatch::findFaceMaxRadius
+(
+ const pointField& faceCentres
+) const
+{
+ // Determine a face furthest away from the axis
+
+ const scalarField magRadSqr
+ (
+ magSqr((faceCentres - rotationCentre_) ^ rotationAxis_)
+ );
+
+ label faceI = findMax(magRadSqr);
+
+ if (debug)
+ {
+ Info<< "findFaceMaxRadius(const pointField&)" << nl
+ << " rotFace = " << faceI << nl
+ << " point = " << faceCentres[faceI] << nl
+ << " distance = " << Foam::sqrt(magRadSqr[faceI])
+ << endl;
+ }
+
+ return faceI;
+}
+
+
+// * * * * * * * * * * * Protecetd Member Functions * * * * * * * * * * * * //
+
+
+void Foam::cyclicAMIPolyPatch::calcTransforms()
+{
+ if (size())
+ {
+ // Half0
+ const cyclicAMIPolyPatch& half0 = *this;
+ vectorField half0Areas(half0.size());
+ forAll(half0, facei)
+ {
+ half0Areas[facei] = half0[facei].normal(half0.points());
+ }
+
+ // Half1
+ const cyclicAMIPolyPatch& half1 = nbrPatch();
+ vectorField half1Areas(half1.size());
+ forAll(half1, facei)
+ {
+ half1Areas[facei] = half1[facei].normal(half1.points());
+ }
+
+ calcTransforms
+ (
+ half0,
+ half0.faceCentres(),
+ half0Areas,
+ half1.faceCentres(),
+ half1Areas
+ );
+ }
+}
+
+
+void Foam::cyclicAMIPolyPatch::calcTransforms
+(
+ const primitivePatch& half0,
+ const pointField& half0Ctrs,
+ const vectorField& half0Areas,
+ const pointField& half1Ctrs,
+ const vectorField& half1Areas
+)
+{
+ if (transform_ != nbrPatch().transform_)
+ {
+ FatalErrorIn("cyclicAMIPolyPatch::calcTransforms()")
+ << "Patch " << name()
+ << " has transform type " << transformTypeNames[transform_]
+ << ", neighbour patch " << nbrPatchName_
+ << " has transform type "
+ << nbrPatch().transformTypeNames[transform_]
+ << exit(FatalError);
+ }
+
+
+ // Calculate transformation tensors
+
+ if ((half0Ctrs.size() <= 0) || (half1Ctrs.size() <= 0))
+ {
+ return;
+ }
+
+ switch (transform_)
+ {
+ case ROTATIONAL:
+ {
+ label face0 = findFaceMaxRadius(half0Ctrs);
+ label face1 = findFaceMaxRadius(half1Ctrs);
+
+ vector n0 = ((half0Ctrs[face0] - rotationCentre_) ^ rotationAxis_);
+ vector n1 = ((half1Ctrs[face1] - rotationCentre_) ^ -rotationAxis_);
+ n0 /= mag(n0) + VSMALL;
+ n1 /= mag(n1) + VSMALL;
+
+ if (debug)
+ {
+ Pout<< "cyclicAMIPolyPatch::calcTransforms :"
+ << " Specified rotation :"
+ << " n0:" << n0 << " n1:" << n1 << endl;
+ }
+
+ // 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);
+ const_cast(forwardT()) = tensorField(1, revT.T());
+ const_cast(reverseT()) = tensorField(1, revT);
+ const_cast(separation()).setSize(0);
+ const_cast(collocated()) = boolList(1, false);
+
+ break;
+ }
+ case TRANSLATIONAL:
+ {
+ // Transform 0 points.
+
+ if (debug)
+ {
+ Pout<< "cyclicAMIPolyPatch::calcTransforms :"
+ << "Specified translation : " << separationVector_
+ << endl;
+ }
+
+ const_cast(forwardT()).clear();
+ const_cast(reverseT()).clear();
+ const_cast(separation()) = vectorField
+ (
+ 1,
+ separationVector_
+ );
+ const_cast(collocated()) = boolList(1, false);
+ break;
+ }
+ default:
+ {
+/*
+ // Assumes that cyclic is planar. This is also the initial
+ // condition for patches without faces.
+
+ // Determine the face with max area on both halves. These
+ // two faces are used to determine the transformation tensors
+ label max0I = findMaxArea(pp0.points(), pp0);
+ vector n0 = pp0[max0I].normal(pp0.points());
+ n0 /= mag(n0) + VSMALL;
+
+ label max1I = findMaxArea(pp1.points(), pp1);
+ vector n1 = pp1[max1I].normal(pp1.points());
+ n1 /= mag(n1) + VSMALL;
+
+ if (mag(n0 & n1) < 1 - matchTolerance())
+ {
+ if (debug)
+ {
+ Pout<< "cyclicAMIPolyPatch::calcTransforms :"
+ << " Detected rotation :"
+ << " n0:" << n0 << " n1:" << n1 << endl;
+ }
+
+ // Rotation (around origin)
+ const tensor revT(rotationTensor(n0, -n1));
+ 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
+ {
+ // Parallel translation
+ const_cast(forwardT()).clear();
+ const_cast(reverseT()).clear();
+ const_cast(separation()) = vectorField
+ (
+ 1,
+ separationVector_
+ );
+ const_cast(collocated()) = boolList(1, false);
+
+ }
+*/
+
+ notImplemented("calcTransforms - unknown transform clause");
+ break;
+ }
+ }
+
+
+ // Calculate typical distance per face
+// tols = calcFaceTol(matchTolerance(), pp1, pp1.points(), half1Ctrs);
+}
+
+
+const Foam::AMIPatchToPatchInterpolation& Foam::cyclicAMIPolyPatch::AMI()
+{
+ if (!AMIPtr_)
+ {
+ const polyPatch& nbr = nbrPatch();
+ pointField nbrPoints = nbrPatch().localPoints();
+
+
+const word myName = nbrPatch().nbrPatch().nbrPatchName();
+
+OFstream osNorg(myName + "_neighbourPatch-org.obj");
+meshTools::writeOBJ(osNorg, nbrPatch().localFaces(), nbrPoints);
+
+ transformPosition(nbrPoints);
+ primitivePatch nbrPatch0
+ (
+ SubList
+ (
+ nbr.localFaces(),
+ nbr.size()
+ ),
+ nbrPoints
+ );
+
+OFstream osN(myName + "_neighbourPatch-trans.obj");
+meshTools::writeOBJ(osN, nbrPatch0.localFaces(), nbrPoints);
+
+OFstream osO(myName + "_ownerPatch.obj");
+meshTools::writeOBJ(osO, this->localFaces(), localPoints());
+
+ // Construct/apply AMI interpolation to determine addressing and weights
+ AMIPtr_ = new AMIPatchToPatchInterpolation
+ (
+ *this,
+ nbrPatch0,
+ surfPtr_()
+ );
+
+
+ vectorField nbrPatchNf
+ (
+ nbrPatch().faceAreas()/mag(nbrPatch().faceAreas())
+ );
+ nbrPatchDelta_ =
+ nbrPatch0.faceCentres() - nbrPatch().faceCellCentres();
+ nbrPatchDelta_ = nbrPatchNf*(nbrPatchNf & nbrPatchDelta_);
+ }
+
+ return *AMIPtr_;
+}
+
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
+{
+ polyPatch::initGeometry(pBufs);
+}
+
+
+void Foam::cyclicAMIPolyPatch::calcGeometry(PstreamBuffers& pBufs)
+{
+ calcGeometry
+ (
+ *this,
+ faceCentres(),
+ faceAreas(),
+ faceCellCentres(),
+ nbrPatch().faceCentres(),
+ nbrPatch().faceAreas(),
+ nbrPatch().faceCellCentres()
+ );
+}
+
+
+void Foam::cyclicAMIPolyPatch::initMovePoints
+(
+ PstreamBuffers& pBufs,
+ const pointField& p
+)
+{
+ polyPatch::initMovePoints(pBufs, p);
+}
+
+
+void Foam::cyclicAMIPolyPatch::movePoints
+(
+ PstreamBuffers& pBufs,
+ const pointField& p
+)
+{
+ polyPatch::movePoints(pBufs, p);
+
+ calcTransforms();
+
+ deleteDemandDrivenData(AMIPtr_);
+
+ AMI();
+}
+
+
+void Foam::cyclicAMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
+{
+ polyPatch::initUpdateMesh(pBufs);
+}
+
+
+void Foam::cyclicAMIPolyPatch::updateMesh(PstreamBuffers& pBufs)
+{
+ polyPatch::updateMesh(pBufs);
+ deleteDemandDrivenData(AMIPtr_);
+// deleteDemandDrivenData(surfPtr_);
+}
+
+
+// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
+
+Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
+(
+ const word& name,
+ const label size,
+ const label start,
+ const label index,
+ const polyBoundaryMesh& bm
+)
+:
+ coupledPolyPatch(name, size, start, index, bm),
+ nbrPatchName_(word::null),
+ nbrPatchID_(-1),
+ transform_(UNKNOWN),
+ rotationAxis_(vector::zero),
+ rotationCentre_(point::zero),
+ separationVector_(vector::zero),
+ AMIPtr_(NULL),
+ surfPtr_(NULL)
+{
+ // Neighbour patch might not be valid yet so no transformation
+ // calculation possible
+}
+
+
+Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
+(
+ const word& name,
+ const dictionary& dict,
+ const label index,
+ const polyBoundaryMesh& bm
+)
+:
+ coupledPolyPatch(name, dict, index, bm),
+ nbrPatchName_(dict.lookup("neighbourPatch")),
+ nbrPatchID_(-1),
+ transform_(UNKNOWN),
+ rotationAxis_(vector::zero),
+ rotationCentre_(point::zero),
+ separationVector_(vector::zero),
+ AMIPtr_(NULL),
+ surfPtr_
+ (
+ searchableSurface::New
+ (
+ dict.lookup("projectionSurfaceType"),
+ IOobject
+ (
+ dict.lookup("projectionSurfaceName"),
+ bm.mesh().time().constant(),
+ "triSurface",
+ bm.mesh(),
+ IOobject::MUST_READ,
+ IOobject::NO_WRITE
+ ),
+ dict
+ )
+ )
+{
+ if (nbrPatchName_ == name)
+ {
+ FatalIOErrorIn
+ (
+ "cyclicAMIPolyPatch::cyclicAMIPolyPatch"
+ "("
+ "const word&, "
+ "const dictionary&, "
+ "const label, "
+ "const polyBoundaryMesh&"
+ ")",
+ dict
+ ) << "Neighbour patch name " << nbrPatchName_
+ << " cannot be the same as this patch " << name
+ << exit(FatalIOError);
+ }
+
+ if (dict.found("transform"))
+ {
+ transform_ = transformTypeNames.read(dict.lookup("transform"));
+ switch (transform_)
+ {
+ case ROTATIONAL:
+ {
+ dict.lookup("rotationAxis") >> rotationAxis_;
+ dict.lookup("rotationCentre") >> rotationCentre_;
+
+ scalar magRot = mag(rotationAxis_);
+ if (magRot < SMALL)
+ {
+ FatalIOErrorIn
+ (
+ "cyclicAMIPolyPatch::cyclicAMIPolyPatch"
+ "("
+ "const word&, "
+ "const dictionary&, "
+ "const label, "
+ "const polyBoundaryMesh&"
+ ")",
+ dict
+ ) << "Illegal rotationAxis " << rotationAxis_ << endl
+ << "Please supply a non-zero vector."
+ << exit(FatalIOError);
+ }
+ rotationAxis_ /= magRot;
+
+ break;
+ }
+ case TRANSLATIONAL:
+ {
+ dict.lookup("separationVector") >> separationVector_;
+ break;
+ }
+ default:
+ {
+ // no additional info required
+ }
+ }
+ }
+
+ // Neighbour patch might not be valid yet so no transformation
+ // calculation possible
+}
+
+
+Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
+(
+ const cyclicAMIPolyPatch& pp,
+ const polyBoundaryMesh& bm
+)
+:
+ coupledPolyPatch(pp, bm),
+ nbrPatchName_(pp.nbrPatchName_),
+ nbrPatchID_(-1),
+ transform_(UNKNOWN),
+ rotationAxis_(vector::zero),
+ rotationCentre_(point::zero),
+ separationVector_(vector::zero),
+ AMIPtr_(NULL),
+ surfPtr_(NULL)
+{
+ // Neighbour patch might not be valid yet so no transformation
+ // calculation possible
+}
+
+
+Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
+(
+ const cyclicAMIPolyPatch& pp,
+ const polyBoundaryMesh& bm,
+ const label index,
+ const label newSize,
+ const label newStart,
+ const word& nbrPatchName
+)
+:
+ coupledPolyPatch(pp, bm, index, newSize, newStart),
+ nbrPatchName_(nbrPatchName),
+ nbrPatchID_(-1),
+ transform_(UNKNOWN),
+ rotationAxis_(vector::zero),
+ rotationCentre_(point::zero),
+ separationVector_(vector::zero),
+ AMIPtr_(NULL),
+ surfPtr_(NULL)
+{
+ if (nbrPatchName_ == name())
+ {
+ FatalErrorIn
+ (
+ "const cyclicAMIPolyPatch& "
+ "const polyBoundaryMesh&, "
+ "const label, "
+ "const label, "
+ "const label, "
+ "const word&"
+ ) << "Neighbour patch name " << nbrPatchName_
+ << " cannot be the same as this patch " << name()
+ << exit(FatalError);
+ }
+
+ // Neighbour patch might not be valid yet so no transformation
+ // calculation possible
+}
+
+
+Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
+(
+ const cyclicAMIPolyPatch& pp,
+ const polyBoundaryMesh& bm,
+ const label index,
+ const labelUList& mapAddressing,
+ const label newStart
+)
+:
+ coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
+ nbrPatchName_(pp.nbrPatchName_),
+ nbrPatchID_(-1),
+ transform_(pp.transform_),
+ rotationAxis_(pp.rotationAxis_),
+ rotationCentre_(pp.rotationCentre_),
+ separationVector_(pp.separationVector_),
+ AMIPtr_(NULL),
+ surfPtr_(NULL)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+Foam::cyclicAMIPolyPatch::~cyclicAMIPolyPatch()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+Foam::label Foam::cyclicAMIPolyPatch::nbrPatchID() const
+{
+ if (nbrPatchID_ == -1)
+ {
+ nbrPatchID_ = this->boundaryMesh().findPatchID(nbrPatchName_);
+
+ if (nbrPatchID_ == -1)
+ {
+ FatalErrorIn("cyclicPolyAMIPatch::nbrPatchID() const")
+ << "Illegal neighbourPatch name " << nbrPatchName_
+ << nl << "Valid patch names are "
+ << this->boundaryMesh().names()
+ << exit(FatalError);
+ }
+
+ // Check that it is a cyclic AMI patch
+ const cyclicAMIPolyPatch& nbrPatch =
+ refCast
+ (
+ this->boundaryMesh()[nbrPatchID_]
+ );
+
+ if (nbrPatch.nbrPatchName() != name())
+ {
+ WarningIn("cyclicAMIPolyPatch::nbrPatchID() const")
+ << "Patch " << name()
+ << " specifies neighbour patch " << nbrPatchName()
+ << nl << " but that in return specifies "
+ << nbrPatch.nbrPatchName() << endl;
+ }
+ }
+
+ return nbrPatchID_;
+}
+
+
+void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const
+{
+ if (!parallel())
+ {
+ if (transform_ == ROTATIONAL)
+ {
+ l = Foam::transform(forwardT(), l - rotationCentre_)
+ + rotationCentre_;
+ }
+ else
+ {
+ l = Foam::transform(forwardT(), l);
+ }
+ }
+ else if (separated())
+ {
+ // transformPosition gets called on the receiving side,
+ // separation gets calculated on the sending side so subtract
+
+ const vectorField& s = separation();
+ if (s.size() == 1)
+ {
+ forAll(l, i)
+ {
+ l[i] -= s[0];
+ }
+ }
+ else
+ {
+ l -= s;
+ }
+ }
+}
+
+
+void Foam::cyclicAMIPolyPatch::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::cyclicAMIPolyPatch::calcGeometry
+(
+ const primitivePatch& referPatch,
+ const pointField& thisCtrs,
+ const vectorField& thisAreas,
+ const pointField& thisCc,
+ const pointField& nbrCtrs,
+ const vectorField& nbrAreas,
+ const pointField& nbrCc
+)
+{
+ calcTransforms
+ (
+ referPatch,
+ thisCtrs,
+ thisAreas,
+ nbrCtrs,
+ nbrAreas
+ );
+
+ deleteDemandDrivenData(AMIPtr_);
+
+ AMI();
+}
+
+
+void Foam::cyclicAMIPolyPatch::initOrder
+(
+ PstreamBuffers& pBufs,
+ const primitivePatch& pp
+) const
+{}
+
+
+bool Foam::cyclicAMIPolyPatch::order
+(
+ PstreamBuffers& pBufs,
+ const primitivePatch& pp,
+ labelList& faceMap,
+ labelList& rotation
+) const
+{
+ faceMap.setSize(pp.size());
+ faceMap = -1;
+
+ rotation.setSize(pp.size());
+ rotation = 0;
+
+ // do nothing
+ return false;
+}
+
+
+void Foam::cyclicAMIPolyPatch::write(Ostream& os) const
+{
+ coupledPolyPatch::write(os);
+}
+
+
+// ************************************************************************* //
diff --git a/src/AMIInterpolation/patches/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/AMIInterpolation/patches/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H
new file mode 100644
index 0000000000..c54ae0f853
--- /dev/null
+++ b/src/AMIInterpolation/patches/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H
@@ -0,0 +1,382 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::cyclicAMIPolyPatch
+
+Description
+ Cyclic patch for Arbitrary Mesh Interface (AMI)
+
+SourceFiles
+ cyclicAMIPolyPatch.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef cyclicAMIPolyPatch_H
+#define cyclicAMIPolyPatch_H
+
+#include "coupledPolyPatch.H"
+#include "AMIPatchToPatchInterpolation.H"
+#include "polyBoundaryMesh.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class cyclicAMIPolyPatch Declaration
+\*---------------------------------------------------------------------------*/
+
+class cyclicAMIPolyPatch
+:
+ public coupledPolyPatch
+{
+
+private:
+
+ // Private data
+
+ //- Name of other half
+ const word nbrPatchName_;
+
+ //- Index of other half
+ mutable label nbrPatchID_;
+
+ //- Neighbour delta field to *this patch
+ vectorField nbrPatchDelta_;
+
+
+ // Transformations
+
+ //- Type of transformation - rotational or translational
+ transformType transform_;
+
+
+ // For rotation
+
+ //- Axis of rotation for rotational cyclics
+ vector rotationAxis_;
+
+ //- point on axis of rotation for rotational cyclics
+ point rotationCentre_;
+
+
+ // For translation
+
+ //- Translation vector
+ vector separationVector_;
+
+
+ //- AMI interpolation class
+ AMIPatchToPatchInterpolation* AMIPtr_;
+
+ //- Projection surface
+ autoPtr surfPtr_;
+
+
+ // Private Member Functions
+
+ //- Return face ID of face at max distance from rotation axis
+ label findFaceMaxRadius(const pointField& faceCentres) const;
+
+ void calcTransforms
+ (
+ const primitivePatch& half0,
+ const pointField& half0Ctrs,
+ const vectorField& half0Areas,
+ const pointField& half1Ctrs,
+ const vectorField& half1Areas
+ );
+
+
+protected:
+
+ // Protected Member Functions
+
+ //- Recalculate the transformation tensors
+ virtual void calcTransforms();
+
+ //- Initialise the calculation of the patch geometry
+ virtual void initGeometry(PstreamBuffers&);
+
+ //- Calculate the patch geometry
+ virtual void calcGeometry(PstreamBuffers&);
+
+ //- Initialise the patches for moving points
+ virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
+
+ //- Correct patches after moving points
+ virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
+
+ //- Initialise the update of the patch topology
+ virtual void initUpdateMesh(PstreamBuffers&);
+
+ //- Update of the patch topology
+ virtual void updateMesh(PstreamBuffers&);
+
+
+public:
+
+// //- Declare friendship with processorCyclicPolyPatch
+// friend class processorCyclicPolyPatch;
+
+ //- Runtime type information
+ TypeName("cyclicAMI");
+
+
+ // Constructors
+
+ //- Construct from (base couped patch) components
+ cyclicAMIPolyPatch
+ (
+ const word& name,
+ const label size,
+ const label start,
+ const label index,
+ const polyBoundaryMesh& bm
+ );
+
+ //- Construct from dictionary
+ cyclicAMIPolyPatch
+ (
+ const word& name,
+ const dictionary& dict,
+ const label index,
+ const polyBoundaryMesh& bm
+ );
+
+ //- Construct as copy, resetting the boundary mesh
+ cyclicAMIPolyPatch(const cyclicAMIPolyPatch&, const polyBoundaryMesh&);
+
+ //- Construct given the original patch and resetting the
+ // face list and boundary mesh information
+ cyclicAMIPolyPatch
+ (
+ const cyclicAMIPolyPatch& pp,
+ const polyBoundaryMesh& bm,
+ const label index,
+ const label newSize,
+ const label newStart,
+ const word& nbrPatchName
+ );
+
+ //- Construct given the original patch and a map
+ cyclicAMIPolyPatch
+ (
+ const cyclicAMIPolyPatch& pp,
+ const polyBoundaryMesh& bm,
+ const label index,
+ const labelUList& mapAddressing,
+ const label newStart
+ );
+
+
+ //- Construct and return a clone, resetting the boundary mesh
+ virtual autoPtr clone(const polyBoundaryMesh& bm) const
+ {
+ return autoPtr(new cyclicAMIPolyPatch(*this, bm));
+ }
+
+ //- Construct and return a clone, resetting the face list
+ // and boundary mesh
+ virtual autoPtr clone
+ (
+ const polyBoundaryMesh& bm,
+ const label index,
+ const label newSize,
+ const label newStart
+ ) const
+ {
+ return autoPtr
+ (
+ new cyclicAMIPolyPatch
+ (
+ *this,
+ bm,
+ index,
+ newSize,
+ newStart,
+ nbrPatchName_
+ )
+ );
+ }
+
+ //- Construct and return a clone, resetting the face list
+ // and boundary mesh
+ virtual autoPtr clone
+ (
+ const polyBoundaryMesh& bm,
+ const label index,
+ const labelUList& mapAddressing,
+ const label newStart
+ ) const
+ {
+ return autoPtr
+ (
+ new cyclicAMIPolyPatch
+ (
+ *this,
+ bm,
+ index,
+ mapAddressing,
+ newStart
+ )
+ );
+ }
+
+
+ //- Destructor
+ virtual ~cyclicAMIPolyPatch();
+
+
+ // Member Functions
+
+ // Access
+
+ //- Neighbour patch name
+ const word& nbrPatchName() const
+ {
+ return nbrPatchName_;
+ }
+
+ //- Neighbour patch ID
+ virtual label nbrPatchID() const;
+
+ //- Does this side own the patch ?
+ virtual bool owner() const
+ {
+ return index() < nbrPatchID();
+ }
+
+ const cyclicAMIPolyPatch& nbrPatch() const
+ {
+ const polyPatch& pp = this->boundaryMesh()[nbrPatchID()];
+ return refCast(pp);
+ }
+
+
+ const vectorField& nbrPatchDelta() const
+ {
+ return nbrPatchDelta_;
+ }
+
+ const AMIPatchToPatchInterpolation& AMI();
+
+
+ // Transformations
+
+ //- Type of transform
+ transformType transform() const
+ {
+ return transform_;
+ }
+
+ //- Axis of rotation for rotational cyclic AMI
+ const vector& rotationAxis() const
+ {
+ return rotationAxis_;
+ }
+
+ //- point on axis of rotation for rotational cyclic AMI
+ const point& rotationCentre() const
+ {
+ return rotationCentre_;
+ }
+
+ //- Translation vector for translational cyclic AMI
+ const vector& separationVector() const
+ {
+ return separationVector_;
+ }
+
+ //- Transform patch-based positions from nbr side to this side
+ virtual void transformPosition(pointField&) const;
+
+ //- Transform a patch-based position from nbr side to this side
+ virtual void transformPosition
+ (
+ point& l,
+ const label faceI
+ ) const;
+
+ template
+ tmp > interpolateToSource(const Field& fld) const
+ {
+ return AMIPtr_->interpolateToSource(fld);
+ }
+
+ template
+ tmp > interpolateToSource(const tmp >& tFld) const
+ {
+ return AMIPtr_->interpolateToSource(tFld);
+ }
+
+
+ //- Calculate the patch geometry
+ virtual void calcGeometry
+ (
+ const primitivePatch& referPatch,
+ const pointField& thisCtrs,
+ const vectorField& thisAreas,
+ const pointField& thisCc,
+ const pointField& nbrCtrs,
+ const vectorField& nbrAreas,
+ const pointField& nbrCc
+ );
+
+ //- Initialize ordering for primitivePatch. Does not
+ // refer to *this (except for name() and type() etc.)
+ virtual void initOrder
+ (
+ PstreamBuffers&,
+ const primitivePatch&
+ ) const;
+
+ //- Return new ordering for primitivePatch.
+ // Ordering is -faceMap: for every face
+ // index of the new face -rotation:for every new face the clockwise
+ // shift of the original face. Return false if nothing changes
+ // (faceMap is identity, rotation is 0), true otherwise.
+ virtual bool order
+ (
+ PstreamBuffers&,
+ const primitivePatch&,
+ labelList& faceMap,
+ labelList& rotation
+ ) const;
+
+ //- Write the polyPatch data as a dictionary
+ virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //