cyclicRepeatAMI: New constraint patch type

A new constraint patch has been added which permits AMI coupling in
cyclic geometries. The coupling is repeated with different multiples of
the cyclic transformation in order to achieve a full correspondence.
This allows, for example, a cylindrical AMI interface to be used in a
sector of a rotational geometry.

The patch is used in a similar manner to cyclicAMI, except that it has
an additional entry, "transformPatch". This entry must name a coupled
patch. The transformation used to repeat the AMI coupling is taken from
this patch. For example, in system/blockMeshDict:

boundary
(
    cyclic1
    {
        type cyclic;
        neighbourPatch cyclic2;
        faces ( ... );
    }

    cyclic2
    {
        type cyclic;
        neighbourPatch cyclic1;
        faces ( ... );
    }

    cyclicRepeatAMI1
    {
        type cyclicRepeatAMI;
        neighbourPatch cyclicRepeatAM2;
        transformPatch cyclic1;
        faces ( ... );
    }

    cyclicRepeatAMI2
    {
        type cyclicRepeatAMI;
        neighbourPatch cyclicRepeatAMI1;
        transformPatch cyclic1;
        faces ( ... );
    }

    // other patches ...
);

In this example, the transformation between cyclic1 and cyclic2 is used
to define the repetition used by the two cyclicRepeatAMI patches.
Whether cyclic1 or cyclic2 is listed as the transform patch is not
important.

A tutorial, incompressible/pimpleFoam/RAS/impeller, has been added to
demonstrate the functionality. This contains two repeating AMI pairs;
one cylindrical and one planar.

A significant amount of maintenance has been carried out on the AMI and
ACMI patches as part of this work. The AMI methods now return
dimensionless weights by default, which prevents ambiguity over the
units of the weight field during construction. Large amounts of
duplicate code have also been removed by deriving ACMI classes from
their AMI equivalents. The reporting and writing of AMI weights has also
been unified.

This work was supported by Dr Victoria Suponitsky, at General Fusion
This commit is contained in:
Will Bainbridge
2018-04-09 14:39:42 +01:00
parent c1b380c867
commit 785a7d9e3f
88 changed files with 4017 additions and 1544 deletions

View File

@ -479,6 +479,103 @@ bool Foam::checkCoupledPoints
}
void Foam::writeAMIWeightsSum
(
const polyMesh& mesh,
const primitivePatch& patch,
const scalarField& wghtSum,
const fileName& file
)
{
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
Foam::PatchTools::gatherAndMerge
(
mesh,
patch.localFaces(),
patch.meshPoints(),
patch.meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints
);
// Collect field
scalarField mergedWeights;
globalFaces().gather
(
UPstream::worldComm,
labelList(UPstream::procID(UPstream::worldComm)),
wghtSum,
mergedWeights
);
// Write the surface
if (Pstream::master())
{
vtkSurfaceWriter().write
(
file.path(),
file.name(),
mergedPoints,
mergedFaces,
"weightsSum",
mergedWeights,
false
);
}
}
void Foam::writeAMIWeightsSums(const polyMesh& mesh)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const word tmName(mesh.time().timeName());
forAll(pbm, patchi)
{
if (isA<cyclicAMIPolyPatch>(pbm[patchi]))
{
const cyclicAMIPolyPatch& cpp =
refCast<const cyclicAMIPolyPatch>(pbm[patchi]);
if (cpp.owner())
{
Info<< "Calculating AMI weights between owner patch: "
<< cpp.name() << " and neighbour patch: "
<< cpp.neighbPatch().name() << endl;
writeAMIWeightsSum
(
mesh,
cpp,
cpp.weightsSum(),
fileName("postProcessing") / "src_" + tmName
);
writeAMIWeightsSum
(
mesh,
cpp.neighbPatch(),
cpp.neighbWeightsSum(),
fileName("postProcessing") / "tgt_" + tmName
);
}
}
}
}
Foam::label Foam::checkGeometry
(
const polyMesh& mesh,
@ -945,136 +1042,7 @@ Foam::label Foam::checkGeometry
if (allGeometry)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const word tmName(mesh.time().timeName());
const word procAndTime(Foam::name(Pstream::myProcNo()) + "_" + tmName);
autoPtr<surfaceWriter> patchWriter;
if (!surfWriter.valid())
{
patchWriter.reset(new vtkSurfaceWriter());
}
const surfaceWriter& wr =
(
surfWriter.valid()
? surfWriter()
: patchWriter()
);
forAll(pbm, patchi)
{
if (isA<cyclicAMIPolyPatch>(pbm[patchi]))
{
const cyclicAMIPolyPatch& cpp =
refCast<const cyclicAMIPolyPatch>(pbm[patchi]);
if (cpp.owner())
{
Info<< "Calculating AMI weights between owner patch: "
<< cpp.name() << " and neighbour patch: "
<< cpp.neighbPatch().name() << endl;
const AMIPatchToPatchInterpolation& ami =
cpp.AMI();
{
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
Foam::PatchTools::gatherAndMerge
(
mesh,
cpp.localFaces(),
cpp.meshPoints(),
cpp.meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints
);
// Collect field
scalarField mergedWeights;
globalFaces().gather
(
UPstream::worldComm,
labelList(UPstream::procID(UPstream::worldComm)),
ami.srcWeightsSum(),
mergedWeights
);
if (Pstream::master())
{
wr.write
(
"postProcessing",
"src_" + tmName,
mergedPoints,
mergedFaces,
"weightsSum",
mergedWeights,
false
);
}
}
{
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
Foam::PatchTools::gatherAndMerge
(
mesh,
cpp.neighbPatch().localFaces(),
cpp.neighbPatch().meshPoints(),
cpp.neighbPatch().meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints
);
// Collect field
scalarField mergedWeights;
globalFaces().gather
(
UPstream::worldComm,
labelList(UPstream::procID(UPstream::worldComm)),
ami.tgtWeightsSum(),
mergedWeights
);
if (Pstream::master())
{
wr.write
(
"postProcessing",
"tgt_" + tmName,
mergedPoints,
mergedFaces,
"weightsSum",
mergedWeights,
false
);
}
}
}
}
}
writeAMIWeightsSums(mesh);
}
return noFailedChecks;

View File

@ -23,6 +23,18 @@ namespace Foam
//- Check 0th vertex on coupled faces
bool checkCoupledPoints(const polyMesh&, const bool report, labelHashSet*);
//- Write out the weights-sums on all the AMI patches
void writeAMIWeightsSums(const polyMesh&);
//- Write out the weights-sum on the given AMI patch
void writeAMIWeightsSum
(
const polyMesh&,
const primitivePatch&,
const scalarField&,
const fileName&
);
label checkGeometry
(
const polyMesh& mesh,

View File

@ -1,3 +1,5 @@
moveDynamicMesh.C
../checkMesh/checkGeometry.C
../checkMesh/checkTools.C
EXE = $(FOAM_APPBIN)/moveDynamicMesh

View File

@ -1,8 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I../checkMesh
EXE_LIBS = \
-ldynamicFvMesh \

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,119 +36,12 @@ Description
#include "vtkSurfaceWriter.H"
#include "cyclicAMIPolyPatch.H"
#include "PatchTools.H"
#include "checkGeometry.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Dump patch + weights to vtk file
void writeWeights
(
const polyMesh& mesh,
const scalarField& wghtSum,
const primitivePatch& patch,
const fileName& directory,
const fileName& prefix,
const word& timeName
)
{
vtkSurfaceWriter writer;
// Collect geometry
labelList pointToGlobal;
labelList uniqueMeshPointLabels;
autoPtr<globalIndex> globalPoints;
autoPtr<globalIndex> globalFaces;
faceList mergedFaces;
pointField mergedPoints;
Foam::PatchTools::gatherAndMerge
(
mesh,
patch.localFaces(),
patch.meshPoints(),
patch.meshPointMap(),
pointToGlobal,
uniqueMeshPointLabels,
globalPoints,
globalFaces,
mergedFaces,
mergedPoints
);
// Collect field
scalarField mergedWeights;
globalFaces().gather
(
UPstream::worldComm,
labelList(UPstream::procID(UPstream::worldComm)),
wghtSum,
mergedWeights
);
if (Pstream::master())
{
writer.write
(
directory,
prefix + "_" + timeName,
mergedPoints,
mergedFaces,
"weightsSum",
mergedWeights,
false
);
}
}
void writeWeights(const polyMesh& mesh)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const word tmName(mesh.time().timeName());
forAll(pbm, patchi)
{
if (isA<cyclicAMIPolyPatch>(pbm[patchi]))
{
const cyclicAMIPolyPatch& cpp =
refCast<const cyclicAMIPolyPatch>(pbm[patchi]);
if (cpp.owner())
{
Info<< "Calculating AMI weights between owner patch: "
<< cpp.name() << " and neighbour patch: "
<< cpp.neighbPatch().name() << endl;
const AMIPatchToPatchInterpolation& ami =
cpp.AMI();
writeWeights
(
mesh,
ami.tgtWeightsSum(),
cpp.neighbPatch(),
"postProcessing",
"tgt",
tmName
);
writeWeights
(
mesh,
ami.srcWeightsSum(),
cpp,
"postProcessing",
"src",
tmName
);
}
}
}
}
int main(int argc, char *argv[])
{
#include "addRegionOption.H"
@ -192,7 +85,7 @@ int main(int argc, char *argv[])
if (checkAMI)
{
writeWeights(mesh);
writeAMIWeightsSums(mesh);
}
runTime.write();

View File

@ -37,6 +37,11 @@ nonuniformTransformCyclic
type nonuniformTransformCyclic;
}
cyclicRepeatAMI
{
type cyclicRepeatAMI;
}
processor
{
type processor;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -98,7 +98,7 @@ Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicGAMGInterfaceField::~cyclicGAMGInterfaceField()
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -164,7 +164,7 @@ Foam::cyclicGAMGInterface::cyclicGAMGInterface
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicGAMGInterface::~cyclicGAMGInterface()
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -84,7 +84,7 @@ Foam::processorCyclicGAMGInterface::processorCyclicGAMGInterface
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorCyclicGAMGInterface::~processorCyclicGAMGInterface()
{}

View File

@ -21,6 +21,7 @@ $(constraintFvPatches)/cyclicACMI/cyclicACMIFvPatch.C
$(constraintFvPatches)/cyclicSlip/cyclicSlipFvPatch.C
$(constraintFvPatches)/empty/emptyFvPatch.C
$(constraintFvPatches)/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatch.C
$(constraintFvPatches)/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.C
$(constraintFvPatches)/processor/processorFvPatch.C
$(constraintFvPatches)/processorCyclic/processorCyclicFvPatch.C
$(constraintFvPatches)/symmetryPlane/symmetryPlaneFvPatch.C
@ -120,6 +121,7 @@ $(constraintFvPatchFields)/empty/emptyFvPatchFields.C
$(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C
$(constraintFvPatchFields)/jumpCyclicAMI/jumpCyclicAMIFvPatchFields.C
$(constraintFvPatchFields)/nonuniformTransformCyclic/nonuniformTransformCyclicFvPatchFields.C
$(constraintFvPatchFields)/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.C
$(constraintFvPatchFields)/processor/processorFvPatchFields.C
$(constraintFvPatchFields)/processor/processorFvPatchScalarField.C
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C
@ -228,6 +230,7 @@ $(constraintFvsPatchFields)/cyclicACMI/cyclicACMIFvsPatchFields.C
$(constraintFvsPatchFields)/cyclicSlip/cyclicSlipFvsPatchFields.C
$(constraintFvsPatchFields)/empty/emptyFvsPatchFields.C
$(constraintFvsPatchFields)/nonuniformTransformCyclic/nonuniformTransformCyclicFvsPatchFields.C
$(constraintFvsPatchFields)/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.C
$(constraintFvsPatchFields)/processor/processorFvsPatchFields.C
$(constraintFvsPatchFields)/processorCyclic/processorCyclicFvsPatchFields.C
$(constraintFvsPatchFields)/symmetryPlane/symmetryPlaneFvsPatchFields.C

View File

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMIFvPatchField
Group
grpCoupledBoundaryConditions
Description
This boundary condition enforces an repeating condition between a pair of
boundaries, whereby communication between the patches is performed using
an arbitrary mesh interface (AMI) interpolation.
Usage
Example of the boundary condition specification:
\verbatim
<patchName>
{
type cyclicRepeatAMI;
}
\endverbatim
Note
The outer boundary of the patch pairs must be similar, i.e. if the owner
patch is transformed to the neighbour patch, the outer perimiter of each
patch should be identical (or very similar).
See also
Foam::AMIInterpolation
SourceFiles
cyclicRepeatAMIFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIFvPatchField_H
#define cyclicRepeatAMIFvPatchField_H
#include "cyclicAMIFvPatchField.H"
#include "cyclicRepeatAMIFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMIFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class cyclicRepeatAMIFvPatchField
:
public cyclicAMIFvPatchField<Type>
{
public:
//- Runtime type information
TypeName(cyclicRepeatAMIFvPatch::typeName_());
// Constructors
//- Inherit parent constructors
using cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField;
//- Construct and return a clone
virtual tmp<fvPatchField<Type>> clone() const
{
return tmp<fvPatchField<Type>>
(
new cyclicRepeatAMIFvPatchField<Type>(*this)
);
}
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type>> clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type>>
(
new cyclicRepeatAMIFvPatchField<Type>(*this, iF)
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMIFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(cyclicRepeatAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIFvPatchFields_H
#define cyclicRepeatAMIFvPatchFields_H
#include "cyclicRepeatAMIFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(cyclicRepeatAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIFvPatchFieldsFwd_H
#define cyclicRepeatAMIFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class cyclicRepeatAMIFvPatchField;
makePatchTypeFieldTypedefs(cyclicRepeatAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,97 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMIFvsPatchField
Description
Foam::cyclicRepeatAMIFvsPatchField
SourceFiles
cyclicRepeatAMIFvsPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIFvsPatchField_H
#define cyclicRepeatAMIFvsPatchField_H
#include "cyclicAMIFvsPatchField.H"
#include "cyclicRepeatAMIFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMIFvsPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class cyclicRepeatAMIFvsPatchField
:
public cyclicAMIFvsPatchField<Type>
{
public:
//- Runtime type information
TypeName(cyclicRepeatAMIFvPatch::typeName_());
// Constructors
//- Inherit parent constructors
using cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField;
//- Construct and return a clone
virtual tmp<fvsPatchField<Type>> clone() const
{
return tmp<fvsPatchField<Type>>
(
new cyclicRepeatAMIFvsPatchField<Type>(*this)
);
}
//- Construct and return a clone setting internal field reference
virtual tmp<fvsPatchField<Type>> clone
(
const DimensionedField<Type, surfaceMesh>& iF
) const
{
return tmp<fvsPatchField<Type>>
(
new cyclicRepeatAMIFvsPatchField<Type>(*this, iF)
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMIFvsPatchFields.H"
#include "fvsPatchFields.H"
#include "surfaceMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFvsPatchFields(cyclicRepeatAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIFvsPatchFields_H
#define cyclicRepeatAMIFvsPatchFields_H
#include "cyclicRepeatAMIFvsPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvsPatchTypeFieldTypedefs(cyclicRepeatAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIFvsPatchFieldsFwd_H
#define cyclicRepeatAMIFvsPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class cyclicRepeatAMIFvsPatchField;
makeFvsPatchTypeFieldTypedefs(cyclicRepeatAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -129,15 +129,26 @@ public:
return this->boundaryMesh()[nonOverlapPatchID()];
}
//- Return a reference to the AMI interpolator
virtual const AMIPatchToPatchInterpolation& AMI() const
//- Return a reference to the AMI interpolators
virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
{
const AMIPatchToPatchInterpolation& AMI =
cyclicACMIPolyPatch_.AMI();
const PtrList<AMIPatchToPatchInterpolation>& AMIs =
cyclicACMIPolyPatch_.AMIs();
updateAreas();
return AMI;
return AMIs;
}
//- Return a reference to the AMI transformations
virtual const List<vectorTensorTransform>& AMITransforms() const
{
const List<vectorTensorTransform>& AMITransforms =
cyclicACMIPolyPatch_.AMITransforms();
updateAreas();
return AMITransforms;
}
//- Are the cyclic planes parallel

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -114,10 +114,16 @@ public:
);
}
//- Return a reference to the AMI interpolator
virtual const AMIPatchToPatchInterpolation& AMI() const
//- Return a reference to the AMI interpolators
virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
{
return cyclicAMIPolyPatch_.AMI();
return cyclicAMIPolyPatch_.AMIs();
}
//- Return a reference to the AMI transforms
virtual const List<vectorTensorTransform>& AMITransforms() const
{
return cyclicAMIPolyPatch_.AMITransforms();
}
//- Return true if applying the low weight correction
@ -126,7 +132,6 @@ public:
return cyclicAMIPolyPatch_.applyLowWeightCorrection();
}
//- Are the cyclic planes parallel
virtual bool parallel() const
{

View File

@ -0,0 +1,38 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMIFvPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicRepeatAMIFvPatch, 0);
addToRunTimeSelectionTable(fvPatch, cyclicRepeatAMIFvPatch, polyPatch);
}
// ************************************************************************* //

View File

@ -0,0 +1,78 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMIFvPatch
Description
Repeating patch for Arbitrary Mesh Interface (AMI)
SourceFiles
cyclicRepeatAMIFvPatch.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIFvPatch_H
#define cyclicRepeatAMIFvPatch_H
#include "cyclicAMIFvPatch.H"
#include "cyclicRepeatAMIPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMIFvPatch Declaration
\*---------------------------------------------------------------------------*/
class cyclicRepeatAMIFvPatch
:
public cyclicAMIFvPatch
{
public:
//- Runtime type information
TypeName(cyclicRepeatAMIPolyPatch::typeName_());
// Constructors
//- Construct from polyPatch
cyclicRepeatAMIFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
:
cyclicAMIFvPatch(patch, bm)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -47,10 +47,7 @@ void Foam::Cloud<ParticleType>::checkPatches() const
const cyclicAMIPolyPatch& cami =
refCast<const cyclicAMIPolyPatch>(pbm[patchi]);
if (cami.owner())
{
ok = ok && (cami.AMI().singlePatchProc() != -1);
}
ok = ok && cami.singlePatchProc() != -1;
}
}

View File

@ -59,6 +59,7 @@ class polyPatch;
class cyclicPolyPatch;
class cyclicAMIPolyPatch;
class cyclicACMIPolyPatch;
class cyclicRepeatAMIPolyPatch;
class processorPolyPatch;
class symmetryPlanePolyPatch;
class symmetryPolyPatch;
@ -315,6 +316,16 @@ protected:
template<class TrackCloudType>
void hitCyclicACMIPatch(TrackCloudType&, trackingData&, const vector&);
//- Overridable function to handle the particle hitting an
// cyclicRepeatAMIPolyPatch
template<class TrackCloudType>
void hitCyclicRepeatAMIPatch
(
TrackCloudType&,
trackingData&,
const vector&
);
//- Overridable function to handle the particle hitting a processorPatch
template<class TrackCloudType>
void hitProcessorPatch(TrackCloudType&, trackingData&);

View File

@ -28,6 +28,7 @@ License
#include "cyclicPolyPatch.H"
#include "cyclicAMIPolyPatch.H"
#include "cyclicACMIPolyPatch.H"
#include "cyclicRepeatAMIPolyPatch.H"
#include "processorPolyPatch.H"
#include "symmetryPlanePolyPatch.H"
#include "symmetryPolyPatch.H"
@ -152,6 +153,10 @@ void Foam::particle::hitFace
{
p.hitCyclicAMIPatch(cloud, ttd, direction);
}
else if (isA<cyclicRepeatAMIPolyPatch>(patch))
{
p.hitCyclicRepeatAMIPatch(cloud, ttd, direction);
}
else if (isA<processorPolyPatch>(patch))
{
p.hitProcessorPatch(cloud, ttd);
@ -276,7 +281,9 @@ void Foam::particle::hitCyclicAMIPatch
static_cast<const cyclicAMIPolyPatch&>(mesh_.boundaryMesh()[patch()]);
const cyclicAMIPolyPatch& receiveCpp = cpp.neighbPatch();
const label sendFacei = cpp.whichFace(facei_);
const label receiveFacei = cpp.pointFace(sendFacei, direction, pos);
const labelPair receiveIs = cpp.pointAMIAndFace(sendFacei, direction, pos);
const label receiveAMIi = receiveIs.first();
const label receiveFacei = receiveIs.second();
if (receiveFacei < 0)
{
@ -287,6 +294,7 @@ void Foam::particle::hitCyclicAMIPatch
<< "Particle lost across " << cyclicAMIPolyPatch::typeName
<< " patches " << cpp.name() << " and " << receiveCpp.name()
<< " at position " << pos << endl;
return;
}
// Set the topology
@ -331,6 +339,18 @@ void Foam::particle::hitCyclicAMIPatch
);
transformProperties(-s);
}
const vectorTensorTransform& T =
cpp.owner()
? cpp.AMITransforms()[receiveAMIi]
: cpp.neighbPatch().AMITransforms()[receiveAMIi];
if (T.hasR())
{
transformProperties(T.R());
}
else if (T.t() != vector::zero)
{
transformProperties(T.t());
}
}
@ -359,7 +379,7 @@ void Foam::particle::hitCyclicACMIPatch
if (!couple && !nonOverlap)
{
vector pos = position();
couple = cpp.pointFace(localFacei, direction, pos) >= 0;
couple = cpp.pointAMIAndFace(localFacei, direction, pos).first() >= 0;
nonOverlap = !couple;
}
@ -377,6 +397,18 @@ void Foam::particle::hitCyclicACMIPatch
}
template<class TrackCloudType>
void Foam::particle::hitCyclicRepeatAMIPatch
(
TrackCloudType& cloud,
trackingData& td,
const vector& direction
)
{
hitCyclicAMIPatch(cloud, td, direction);
}
template<class TrackCloudType>
void Foam::particle::hitProcessorPatch(TrackCloudType&, trackingData&)
{}

View File

@ -221,79 +221,118 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::projectPointsToSurface
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
(
const scalarField& patchAreas,
const word& patchName,
const labelListList& addr,
scalarListList& wght,
scalarField& wghtSum,
const bool conformal,
const bool output,
const scalar lowWeightTol
const scalarListList& wght,
scalarField& wghtSum
)
{
// Normalise the weights
wghtSum.setSize(wght.size(), 0.0);
label nLowWeight = 0;
wghtSum.setSize(wght.size());
wghtSum = Zero;
forAll(wght, facei)
{
scalarList& w = wght[facei];
if (w.size())
{
scalar denom = patchAreas[facei];
scalar s = sum(w);
scalar t = s/denom;
if (conformal)
{
denom = s;
}
forAll(w, i)
{
w[i] /= denom;
}
wghtSum[facei] = t;
if (t < lowWeightTol)
{
nLowWeight++;
}
}
else
{
wghtSum[facei] = 0;
wghtSum[facei] = sum(wght[facei]);
}
}
if (output)
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
(
const UPtrList<scalarListList>& wghts,
scalarField& wghtSum
)
{
const label nFace = returnReduce(wght.size(), sumOp<label>());
wghtSum.setSize(wghts[0].size());
wghtSum = Zero;
if (nFace)
forAll(wghts[0], facei)
{
Info<< indent
<< "AMI: Patch " << patchName
<< " sum(weights) min/max/average = "
<< gMin(wghtSum) << ", "
forAll(wghts, wghtsi)
{
forAll(wghts[wghtsi][facei], i)
{
wghtSum[facei] += wghts[wghtsi][facei][i];
}
}
}
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::reportSumWeights
(
const scalarField& patchAreas,
const word& patchName,
const scalarField& wghtSum,
const scalar lowWeightTol
)
{
if (returnReduce(wghtSum.size(), sumOp<label>()) == 0)
{
return;
}
label nLowWeight = 0;
forAll(wghtSum, facei)
{
if (wghtSum[facei] < lowWeightTol)
{
++ nLowWeight;
}
}
reduce(nLowWeight, sumOp<label>());
Info<< indent << "AMI: Patch " << patchName
<< " sum(weights) min/max/average = " << gMin(wghtSum) << ", "
<< gMax(wghtSum) << ", "
<< gSum(wghtSum*patchAreas)/gSum(patchAreas) << endl;
const label nLow = returnReduce(nLowWeight, sumOp<label>());
if (nLow)
if (nLowWeight)
{
Info<< indent
<< "AMI: Patch " << patchName
<< " identified " << nLow
<< " faces with weights less than " << lowWeightTol
<< endl;
Info<< indent << "AMI: Patch " << patchName << " identified "
<< nLowWeight << " faces with weights less than "
<< lowWeightTol << endl;
}
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
(
scalarListList& wght,
const scalarField& wghtSum
)
{
forAll(wghtSum, facei)
{
scalarList& w = wght[facei];
forAll(w, i)
{
w[i] /= wghtSum[facei];
}
}
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
(
UPtrList<scalarListList>& wghts,
const scalarField& wghtSum
)
{
forAll(wghtSum, facei)
{
forAll(wghts, wghtsi)
{
scalarList& w = wghts[wghtsi][facei];
forAll(w, i)
{
w[i] /= wghtSum[facei];
}
}
}
@ -481,6 +520,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
label coarseFacei = sourceRestrictAddressing[facei];
const scalar coarseArea = srcMagSf[coarseFacei];
labelList& newElems = srcAddress[coarseFacei];
scalarList& newWeights = srcWeights[coarseFacei];
@ -493,11 +534,11 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
if (index == -1)
{
newElems.append(coarseElemI);
newWeights.append(fineArea*weights[i]);
newWeights.append(fineArea/coarseArea*weights[i]);
}
else
{
newWeights[index] += fineArea*weights[i];
newWeights[index] += fineArea/coarseArea*weights[i];
}
}
}
@ -527,6 +568,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
label coarseFacei = sourceRestrictAddressing[facei];
const scalar coarseArea = srcMagSf[coarseFacei];
labelList& newElems = srcAddress[coarseFacei];
scalarList& newWeights = srcWeights[coarseFacei];
@ -539,28 +582,15 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::agglomerate
if (index == -1)
{
newElems.append(coarseElemI);
newWeights.append(fineArea*weights[i]);
newWeights.append(fineArea/coarseArea*weights[i]);
}
else
{
newWeights[index] += fineArea*weights[i];
newWeights[index] += fineArea/coarseArea*weights[i];
}
}
}
}
// Weights normalisation
normaliseWeights
(
srcMagSf,
"source",
srcAddress,
srcWeights,
srcWeightsSum,
true,
false,
-1
);
}
@ -569,7 +599,8 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const autoPtr<searchableSurface>& surfPtr
const autoPtr<searchableSurface>& surfPtr,
const bool report
)
{
if (surfPtr.valid())
@ -624,11 +655,11 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::constructFromSurface
// Calculate AMI interpolation
update(srcPatch0, tgtPatch0);
update(srcPatch0, tgtPatch0, report);
}
else
{
update(srcPatch, tgtPatch);
update(srcPatch, tgtPatch, report);
}
}
@ -644,7 +675,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
const bool requireMatch,
const interpolationMethod& method,
const scalar lowWeightCorrection,
const bool reverseTarget
const bool reverseTarget,
const bool report
)
:
methodName_(interpolationMethodToWord(method)),
@ -662,7 +694,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
update(srcPatch, tgtPatch);
update(srcPatch, tgtPatch, report);
}
@ -675,7 +707,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
const bool requireMatch,
const word& methodName,
const scalar lowWeightCorrection,
const bool reverseTarget
const bool reverseTarget,
const bool report
)
:
methodName_(methodName),
@ -693,7 +726,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
update(srcPatch, tgtPatch);
update(srcPatch, tgtPatch, report);
}
@ -707,7 +740,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
const bool requireMatch,
const interpolationMethod& method,
const scalar lowWeightCorrection,
const bool reverseTarget
const bool reverseTarget,
const bool report
)
:
methodName_(interpolationMethodToWord(method)),
@ -725,7 +759,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
constructFromSurface(srcPatch, tgtPatch, surfPtr);
constructFromSurface(srcPatch, tgtPatch, surfPtr, report);
}
@ -739,7 +773,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
const bool requireMatch,
const word& methodName,
const scalar lowWeightCorrection,
const bool reverseTarget
const bool reverseTarget,
const bool report
)
:
methodName_(methodName),
@ -757,7 +792,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
srcMapPtr_(nullptr),
tgtMapPtr_(nullptr)
{
constructFromSurface(srcPatch, tgtPatch, surfPtr);
constructFromSurface(srcPatch, tgtPatch, surfPtr, report);
}
@ -766,7 +801,8 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
(
const AMIInterpolation<SourcePatch, TargetPatch>& fineAMI,
const labelList& sourceRestrictAddressing,
const labelList& targetRestrictAddressing
const labelList& targetRestrictAddressing,
const bool report
)
:
methodName_(fineAMI.methodName_),
@ -825,9 +861,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
<< exit(FatalError);
}
// Agglomerate addresses and weights
agglomerate
(
fineAMI.tgtMapPtr_,
@ -861,6 +895,17 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
tgtWeightsSum_,
srcMapPtr_
);
// Weight summation and normalisation
sumWeights(*this);
if (report)
{
reportSumWeights(*this);
}
if (requireMatch_)
{
normaliseWeights(*this);
}
}
@ -877,7 +922,8 @@ template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch
const TargetPatch& tgtPatch,
const bool report
)
{
label srcTotalSize = returnReduce(srcPatch.size(), sumOp<label>());
@ -894,11 +940,14 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
return;
}
if (report)
{
Info<< indent
<< "AMI: Creating addressing and weights between "
<< srcTotalSize << " source faces and "
<< tgtTotalSize << " target faces"
<< endl;
}
// Calculate face areas
srcMagSf_ = patchMagSf(srcPatch, triMode_);
@ -948,6 +997,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
),
newTgtPoints
);
scalarField newTgtMagSf(patchMagSf(newTgtPatch, triMode_));
// Calculate AMI interpolation
autoPtr<AMIMethod<SourcePatch, TargetPatch>> AMIPtr
@ -958,7 +1008,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
srcPatch,
newTgtPatch,
srcMagSf_,
tgtMagSf_,
newTgtMagSf,
triMode_,
reverseTarget_,
requireMatch_ && (lowWeightCorrection_ < 0)
@ -1036,30 +1086,6 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
scalarList()
);
// Weights normalisation
normaliseWeights
(
srcMagSf_,
"source",
srcAddress_,
srcWeights_,
srcWeightsSum_,
AMIPtr->conformal(),
true,
lowWeightCorrection_
);
normaliseWeights
(
tgtMagSf_,
"target",
tgtAddress_,
tgtWeights_,
tgtWeightsSum_,
AMIPtr->conformal(),
true,
lowWeightCorrection_
);
// Cache maps and reset addresses
List<Map<label>> cMap;
srcMapPtr_.reset(new mapDistribute(globalSrcFaces, tgtAddress_, cMap));
@ -1095,29 +1121,17 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
tgtAddress_,
tgtWeights_
);
}
normaliseWeights
(
srcMagSf_,
"source",
srcAddress_,
srcWeights_,
srcWeightsSum_,
AMIPtr->conformal(),
true,
lowWeightCorrection_
);
normaliseWeights
(
tgtMagSf_,
"target",
tgtAddress_,
tgtWeights_,
tgtWeightsSum_,
AMIPtr->conformal(),
true,
lowWeightCorrection_
);
// Weight summation and normalisation
sumWeights(*this);
if (report)
{
reportSumWeights(*this);
}
if (requireMatch_)
{
normaliseWeights(*this);
}
if (debug)
@ -1133,6 +1147,110 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
)
{
sumWeights(AMI.srcWeights_, AMI.srcWeightsSum_);
sumWeights(AMI.tgtWeights_, AMI.tgtWeightsSum_);
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::sumWeights
(
PtrList<AMIInterpolation<SourcePatch, TargetPatch>>& AMIs
)
{
UPtrList<scalarListList> srcWeights(AMIs.size());
forAll(AMIs, i)
{
srcWeights.set(i, &AMIs[i].srcWeights_);
}
sumWeights(srcWeights, AMIs[0].srcWeightsSum_);
for (label i = 1; i < AMIs.size(); ++ i)
{
AMIs[i].srcWeightsSum_ = AMIs[0].srcWeightsSum_;
}
UPtrList<scalarListList> tgtWeights(AMIs.size());
forAll(AMIs, i)
{
tgtWeights.set(i, &AMIs[i].tgtWeights_);
}
sumWeights(tgtWeights, AMIs[0].tgtWeightsSum_);
for (label i = 1; i < AMIs.size(); ++ i)
{
AMIs[i].tgtWeightsSum_ = AMIs[0].tgtWeightsSum_;
}
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::reportSumWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
)
{
reportSumWeights
(
AMI.srcMagSf_,
"source",
AMI.srcWeightsSum_,
AMI.lowWeightCorrection_
);
reportSumWeights
(
AMI.tgtMagSf_,
"target",
AMI.tgtWeightsSum_,
AMI.lowWeightCorrection_
);
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
)
{
normaliseWeights(AMI.srcWeights_, AMI.srcWeightsSum_);
normaliseWeights(AMI.tgtWeights_, AMI.tgtWeightsSum_);
}
template<class SourcePatch, class TargetPatch>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::normaliseWeights
(
UPtrList<AMIInterpolation<SourcePatch, TargetPatch>>& AMIs
)
{
UPtrList<scalarListList> srcWeights(AMIs.size());
forAll(AMIs, i)
{
srcWeights.set(i, &AMIs[i].srcWeights_);
}
normaliseWeights(srcWeights, AMIs[0].srcWeightsSum_);
UPtrList<scalarListList> tgtWeights(AMIs.size());
forAll(AMIs, i)
{
tgtWeights.set(i, &AMIs[i].tgtWeights_);
}
normaliseWeights(tgtWeights, AMIs[0].tgtWeightsSum_);
}
template<class SourcePatch, class TargetPatch>
template<class Type, class CombineOp>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -81,6 +81,15 @@ class AMIInterpolation
{
public:
// Public typedefs
// Typedef to SourcePatch type this AMIInterplation is instantiated on
typedef SourcePatch sourcePatchType;
// Typedef to TargetPatch type this AMIInterplation is instantiated on
typedef TargetPatch targetPatchType;
// Public data types
//- Enumeration specifying interpolation method
@ -239,25 +248,48 @@ private:
) const;
// Evaluation
// Manipulation
//- Normalise the (area) weights - suppresses numerical error in
// weights calculation
// NOTE: if area weights are incorrect by 'a significant amount'
// normalisation may stabilise the solution, but will introduce
// numerical error!
static void normaliseWeights
//- Sum the weights for each face
static void sumWeights
(
const scalarListList& wght,
scalarField& wghtSum
);
//- As above, but for multiple sets of weights
static void sumWeights
(
const UPtrList<scalarListList>& wghts,
scalarField& wghtSum
);
//- Print out information relating to the weights sum. Values close
// to one are ideal. This information acts as a measure of the
// quality of the AMI.
static void reportSumWeights
(
const scalarField& patchAreas,
const word& patchName,
const labelListList& addr,
scalarListList& wght,
scalarField& wghtSum,
const bool conformal,
const bool output,
const scalarField& wghtSum,
const scalar lowWeightTol
);
//- Normalise the weights so that they sum to one for each face.
// This may stabilise the solution at the expense of accuracy.
static void normaliseWeights
(
scalarListList& wght,
const scalarField& wghtSum
);
//- As above but for multiple sets of weights
static void normaliseWeights
(
UPtrList<scalarListList>& wghts,
const scalarField& wghtSum
);
// Constructor helpers
@ -282,7 +314,8 @@ private:
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch,
const autoPtr<searchableSurface>& surfPtr
const autoPtr<searchableSurface>& surfPtr,
const bool report
);
public:
@ -298,7 +331,8 @@ public:
const bool requireMatch = true,
const interpolationMethod& method = imFaceAreaWeight,
const scalar lowWeightCorrection = -1,
const bool reverseTarget = false
const bool reverseTarget = false,
const bool report = true
);
//- Construct from components
@ -311,7 +345,8 @@ public:
const word& methodName =
interpolationMethodToWord(imFaceAreaWeight),
const scalar lowWeightCorrection = -1,
const bool reverseTarget = false
const bool reverseTarget = false,
const bool report = true
);
//- Construct from components, with projection surface
@ -324,7 +359,8 @@ public:
const bool requireMatch = true,
const interpolationMethod& method = imFaceAreaWeight,
const scalar lowWeightCorrection = -1,
const bool reverseTarget = false
const bool reverseTarget = false,
const bool report = true
);
//- Construct from components, with projection surface
@ -338,7 +374,8 @@ public:
const word& methodName =
interpolationMethodToWord(imFaceAreaWeight),
const scalar lowWeightCorrection = -1,
const bool reverseTarget = false
const bool reverseTarget = false,
const bool report = true
);
//- Construct from agglomeration of AMIInterpolation. Agglomeration
@ -347,19 +384,14 @@ public:
(
const AMIInterpolation<SourcePatch, TargetPatch>& fineAMI,
const labelList& sourceRestrictAddressing,
const labelList& neighbourRestrictAddressing
const labelList& neighbourRestrictAddressing,
const bool report = false
);
//- Destructor
~AMIInterpolation();
// Typedef to SourcePatch type this AMIInterplation is instantiated on
typedef SourcePatch sourcePatchType;
// Typedef to TargetPatch type this AMIInterplation is instantiated on
typedef TargetPatch targetPatchType;
// Member Functions
@ -438,7 +470,40 @@ public:
void update
(
const SourcePatch& srcPatch,
const TargetPatch& tgtPatch
const TargetPatch& tgtPatch,
const bool report
);
//- Sum the weights on both sides of an AMI
static void sumWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
);
//- As above, but for multiple AMI-s
static void sumWeights
(
PtrList<AMIInterpolation<SourcePatch, TargetPatch>>& AMIs
);
//- Print out information relating to the weights sum. Values close
// to one are ideal. This information acts as a measure of the
// quality of the AMI.
static void reportSumWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
);
//- Normalise the weights on both sides of an AMI
static void normaliseWeights
(
AMIInterpolation<SourcePatch, TargetPatch>& AMI
);
//- As above, but for multiple AMI-s
static void normaliseWeights
(
UPtrList<AMIInterpolation<SourcePatch, TargetPatch>>& AMIs
);

View File

@ -309,15 +309,13 @@ void Foam::directAMI<SourcePatch, TargetPatch>::calculate
// transfer data to persistent storage
forAll(srcAddr, i)
{
scalar magSf = this->srcMagSf_[i];
srcAddress[i].transfer(srcAddr[i]);
srcWeights[i] = scalarList(1, magSf);
srcWeights[i] = scalarList(1, 1.0);
}
forAll(tgtAddr, i)
{
scalar magSf = this->tgtMagSf_[i];
tgtAddress[i].transfer(tgtAddr[i]);
tgtWeights[i] = scalarList(1, magSf);
tgtWeights[i] = scalarList(1, 1.0);
}
}

View File

@ -141,23 +141,28 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
nbrFaces
);
const scalar srcArea = this->srcMagSf_[srcFacei];
bool faceProcessed = false;
do
{
// process new target face
label tgtFacei = nbrFaces.remove();
const label tgtFacei = nbrFaces.remove();
visitedFaces.append(tgtFacei);
scalar area = interArea(srcFacei, tgtFacei);
const scalar tgtArea = this->tgtMagSf_[tgtFacei];
// calculate the intersection area
const scalar area = interArea(srcFacei, tgtFacei);
// store when intersection fractional area > min weight
if (area/this->srcMagSf_[srcFacei] > minWeight())
if (area/srcArea > minWeight())
{
srcAddr[srcFacei].append(tgtFacei);
srcWght[srcFacei].append(area);
srcWght[srcFacei].append(area/srcArea);
tgtAddr[tgtFacei].append(srcFacei);
tgtWght[tgtFacei].append(area);
tgtWght[tgtFacei].append(area/tgtArea);
this->appendNbrFaces
(
@ -370,10 +375,9 @@ restartUncoveredSourceFace
labelHashSet lowWeightFaces(100);
forAll(srcWght, srcFacei)
{
scalar s = sum(srcWght[srcFacei]);
scalar t = s/this->srcMagSf_[srcFacei];
const scalar s = sum(srcWght[srcFacei]);
if (t < 0.5)
if (s < 0.5)
{
lowWeightFaces.insert(srcFacei);
}

View File

@ -324,15 +324,13 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::calculate
// transfer data to persistent storage
forAll(srcAddr, i)
{
scalar magSf = this->srcMagSf_[i];
srcAddress[i].transfer(srcAddr[i]);
srcWeights[i] = scalarList(1, magSf);
srcWeights[i] = scalarList(1, 1.0);
}
forAll(tgtAddr, i)
{
scalar magSf = this->tgtMagSf_[i];
tgtAddress[i].transfer(tgtAddr[i]);
tgtWeights[i] = scalarList(1, magSf);
tgtWeights[i] = scalarList(1, 1.0);
}
}

View File

@ -49,7 +49,7 @@ Description
The surface is, in general, not flat. Any deviation between the two end
normals generates expansion, contraction, and twist in the surface. The
surface connects with surfaces eminating from connected edges along the end
surface connects with surfaces emanating from connected edges along the end
normals. This is what makes the projection fill space and generate
consistent overlaps between neighbouring faces.

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,17 +55,8 @@ Foam::cyclicACMIGAMGInterfaceField::cyclicACMIGAMGInterfaceField
const lduInterfaceField& fineInterface
)
:
GAMGInterfaceField(GAMGCp, fineInterface),
cyclicACMIInterface_(refCast<const cyclicACMIGAMGInterface>(GAMGCp)),
doTransform_(false),
rank_(0)
{
const cyclicAMILduInterfaceField& p =
refCast<const cyclicAMILduInterfaceField>(fineInterface);
doTransform_ = p.doTransform();
rank_ = p.rank();
}
cyclicAMIGAMGInterfaceField(GAMGCp, fineInterface)
{}
Foam::cyclicACMIGAMGInterfaceField::cyclicACMIGAMGInterfaceField
@ -75,55 +66,14 @@ Foam::cyclicACMIGAMGInterfaceField::cyclicACMIGAMGInterfaceField
const int rank
)
:
GAMGInterfaceField(GAMGCp, doTransform, rank),
cyclicACMIInterface_(refCast<const cyclicACMIGAMGInterface>(GAMGCp)),
doTransform_(doTransform),
rank_(rank)
cyclicAMIGAMGInterfaceField(GAMGCp, doTransform, rank)
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicACMIGAMGInterfaceField::~cyclicACMIGAMGInterfaceField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cyclicACMIGAMGInterfaceField::updateInterfaceMatrix
(
scalarField& result,
const scalarField& psiInternal,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes
) const
{
// Get neighbouring field
scalarField pnf
(
cyclicACMIInterface_.neighbPatch().interfaceInternalField(psiInternal)
);
// Transform according to the transformation tensors
transformCoupleField(pnf, cmpt);
if (cyclicACMIInterface_.owner())
{
pnf = cyclicACMIInterface_.AMI().interpolateToSource(pnf);
}
else
{
pnf = cyclicACMIInterface_.neighbPatch().AMI().interpolateToTarget(pnf);
}
const labelUList& faceCells = cyclicACMIInterface_.faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
// ************************************************************************* //

View File

@ -36,9 +36,7 @@ SourceFiles
#ifndef cyclicACMIGAMGInterfaceField_H
#define cyclicACMIGAMGInterfaceField_H
#include "GAMGInterfaceField.H"
#include "cyclicACMIGAMGInterface.H"
#include "cyclicACMILduInterfaceField.H"
#include "cyclicAMIGAMGInterfaceField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,30 +49,8 @@ namespace Foam
class cyclicACMIGAMGInterfaceField
:
public GAMGInterfaceField,
public cyclicACMILduInterfaceField
public cyclicAMIGAMGInterfaceField
{
// Private data
//- Local reference cast into the cyclic interface
const cyclicACMIGAMGInterface& cyclicACMIInterface_;
//- Is the transform required
bool doTransform_;
//- Rank of component for transformation
int rank_;
// Private Member Functions
//- Disallow default bitwise copy construct
cyclicACMIGAMGInterfaceField(const cyclicACMIGAMGInterfaceField&);
//- Disallow default bitwise assignment
void operator=(const cyclicACMIGAMGInterfaceField&);
public:
//- Runtime type information
@ -101,57 +77,6 @@ public:
//- Destructor
virtual ~cyclicACMIGAMGInterfaceField();
// Member Functions
// Access
//- Return size
label size() const
{
return cyclicACMIInterface_.size();
}
// Interface matrix update
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
scalarField& result,
const scalarField& psiInternal,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
//- Cyclic interface functions
//- Does the interface field perform the transformation
virtual bool doTransform() const
{
return doTransform_;
}
//- Return face transformation tensor
virtual const tensorField& forwardT() const
{
return cyclicACMIInterface_.forwardT();
}
//- Return neighbour-cell transformation tensor
virtual const tensorField& reverseT() const
{
return cyclicACMIInterface_.reverseT();
}
//- Return rank of component for transform
virtual int rank() const
{
return rank_;
}
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -82,7 +82,7 @@ Foam::cyclicAMIGAMGInterfaceField::cyclicAMIGAMGInterfaceField
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicAMIGAMGInterfaceField::~cyclicAMIGAMGInterfaceField()
{}
@ -99,29 +99,51 @@ void Foam::cyclicAMIGAMGInterfaceField::updateInterfaceMatrix
const Pstream::commsTypes
) const
{
const cyclicAMIGAMGInterface& thisInterface = cyclicAMIInterface_;
const cyclicAMIGAMGInterface& neiInterface = thisInterface.neighbPatch();
// Get neighbouring field
scalarField pnf
(
cyclicAMIInterface_.neighbPatch().interfaceInternalField(psiInternal)
);
scalarField pnf(neiInterface.interfaceInternalField(psiInternal));
// Transform according to the transformation tensors
transformCoupleField(pnf, cmpt);
if (cyclicAMIInterface_.owner())
// Transform and interpolate
scalarField pf(size(), Zero);
if (thisInterface.owner())
{
pnf = cyclicAMIInterface_.AMI().interpolateToSource(pnf);
forAll(thisInterface.AMIs(), i)
{
const scalar r =
pow
(
inv(thisInterface.AMITransforms()[i]).R()(cmpt, cmpt),
rank()
);
pf += thisInterface.AMIs()[i].interpolateToSource(r*pnf);
}
}
else
{
pnf = cyclicAMIInterface_.neighbPatch().AMI().interpolateToTarget(pnf);
forAll(neiInterface.AMIs(), i)
{
const scalar r =
pow
(
neiInterface.AMITransforms()[i].R()(cmpt, cmpt),
rank()
);
pf += neiInterface.AMIs()[i].interpolateToTarget(r*pnf);
}
}
// Multiply the field by coefficients and add into the result
const labelUList& faceCells = cyclicAMIInterface_.faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
result[faceCells[elemI]] -= coeffs[elemI]*pf[elemI];
}
}

View File

@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMIGAMGInterfaceField.H"
#include "addToRunTimeSelectionTable.H"
#include "lduMatrix.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicRepeatAMIGAMGInterfaceField, 0);
addToRunTimeSelectionTable
(
GAMGInterfaceField,
cyclicRepeatAMIGAMGInterfaceField,
lduInterface
);
addToRunTimeSelectionTable
(
GAMGInterfaceField,
cyclicRepeatAMIGAMGInterfaceField,
lduInterfaceField
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMIGAMGInterfaceField::cyclicRepeatAMIGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const lduInterfaceField& fineInterface
)
:
cyclicAMIGAMGInterfaceField(GAMGCp, fineInterface)
{}
Foam::cyclicRepeatAMIGAMGInterfaceField::cyclicRepeatAMIGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const bool doTransform,
const int rank
)
:
cyclicAMIGAMGInterfaceField(GAMGCp, doTransform, rank)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMIGAMGInterfaceField::~cyclicRepeatAMIGAMGInterfaceField()
{}
// ************************************************************************* //

View File

@ -0,0 +1,90 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMIGAMGInterfaceField
Description
GAMG agglomerated repeat AMI interface field.
SourceFiles
cyclicRepeatAMIGAMGInterfaceField.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIGAMGInterfaceField_H
#define cyclicRepeatAMIGAMGInterfaceField_H
#include "cyclicAMIGAMGInterfaceField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMIGAMGInterfaceField Declaration
\*---------------------------------------------------------------------------*/
class cyclicRepeatAMIGAMGInterfaceField
:
public cyclicAMIGAMGInterfaceField
{
public:
//- Runtime type information
TypeName("cyclicRepeatAMI");
// Constructors
//- Construct from GAMG interface and fine level interface field
cyclicRepeatAMIGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const lduInterfaceField& fineInterfaceField
);
//- Construct from GAMG interface and fine level interface field
cyclicRepeatAMIGAMGInterfaceField
(
const GAMGInterface& GAMGCp,
const bool doTransform,
const int rank
);
//- Destructor
virtual ~cyclicRepeatAMIGAMGInterfaceField();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -55,144 +55,23 @@ Foam::cyclicACMIGAMGInterface::cyclicACMIGAMGInterface
const label coarseComm
)
:
GAMGInterface
cyclicAMIGAMGInterface
(
index,
coarseInterfaces
),
fineCyclicACMIInterface_
(
refCast<const cyclicACMILduInterface>(fineInterface)
coarseInterfaces,
fineInterface,
localRestrictAddressing,
neighbourRestrictAddressing,
fineLevelIndex,
coarseComm
)
{
// Construct face agglomeration from cell agglomeration
{
// From coarse face to cell
DynamicList<label> dynFaceCells(localRestrictAddressing.size());
// From face to coarse face
DynamicList<label> dynFaceRestrictAddressing
(
localRestrictAddressing.size()
);
Map<label> masterToCoarseFace(localRestrictAddressing.size());
forAll(localRestrictAddressing, ffi)
{
label curMaster = localRestrictAddressing[ffi];
Map<label>::const_iterator fnd = masterToCoarseFace.find
(
curMaster
);
if (fnd == masterToCoarseFace.end())
{
// New coarse face
label coarseI = dynFaceCells.size();
dynFaceRestrictAddressing.append(coarseI);
dynFaceCells.append(curMaster);
masterToCoarseFace.insert(curMaster, coarseI);
}
else
{
// Already have coarse face
dynFaceRestrictAddressing.append(fnd());
}
}
faceCells_.transfer(dynFaceCells);
faceRestrictAddressing_.transfer(dynFaceRestrictAddressing);
}
{}
// On the owner side construct the AMI
if (fineCyclicACMIInterface_.owner())
{
// Construct the neighbour side agglomeration (as the neighbour would
// do it so it the exact loop above using neighbourRestrictAddressing
// instead of localRestrictAddressing)
labelList nbrFaceRestrictAddressing;
{
// From face to coarse face
DynamicList<label> dynNbrFaceRestrictAddressing
(
neighbourRestrictAddressing.size()
);
Map<label> masterToCoarseFace(neighbourRestrictAddressing.size());
forAll(neighbourRestrictAddressing, ffi)
{
label curMaster = neighbourRestrictAddressing[ffi];
Map<label>::const_iterator fnd = masterToCoarseFace.find
(
curMaster
);
if (fnd == masterToCoarseFace.end())
{
// New coarse face
label coarseI = masterToCoarseFace.size();
dynNbrFaceRestrictAddressing.append(coarseI);
masterToCoarseFace.insert(curMaster, coarseI);
}
else
{
// Already have coarse face
dynNbrFaceRestrictAddressing.append(fnd());
}
}
nbrFaceRestrictAddressing.transfer(dynNbrFaceRestrictAddressing);
}
amiPtr_.reset
(
new AMIPatchToPatchInterpolation
(
fineCyclicACMIInterface_.AMI(),
faceRestrictAddressing_,
nbrFaceRestrictAddressing
)
);
}
}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicACMIGAMGInterface::~cyclicACMIGAMGInterface()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::labelField>
Foam::cyclicACMIGAMGInterface::internalFieldTransfer
(
const Pstream::commsTypes,
const labelUList& iF
) const
{
const cyclicACMIGAMGInterface& nbr =
dynamic_cast<const cyclicACMIGAMGInterface&>(neighbPatch());
const labelUList& nbrFaceCells = nbr.faceCells();
tmp<labelField> tpnf(new labelField(nbrFaceCells.size()));
labelField& pnf = tpnf.ref();
forAll(pnf, facei)
{
pnf[facei] = iF[nbrFaceCells[facei]];
}
return tpnf;
}
// ************************************************************************* //

View File

@ -35,8 +35,7 @@ SourceFiles
#ifndef cyclicACMIGAMGInterface_H
#define cyclicACMIGAMGInterface_H
#include "GAMGInterface.H"
#include "cyclicACMILduInterface.H"
#include "cyclicAMIGAMGInterface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,28 +48,8 @@ namespace Foam
class cyclicACMIGAMGInterface
:
public GAMGInterface,
public cyclicACMILduInterface
public cyclicAMIGAMGInterface
{
// Private data
//- Reference for the cyclicLduInterface from which this is
// agglomerated
const cyclicACMILduInterface& fineCyclicACMIInterface_;
//- AMI interface
autoPtr<AMIPatchToPatchInterpolation> amiPtr_;
// Private Member Functions
//- Disallow default bitwise copy construct
cyclicACMIGAMGInterface(const cyclicACMIGAMGInterface&);
//- Disallow default bitwise assignment
void operator=(const cyclicACMIGAMGInterface&);
public:
//- Runtime type information
@ -95,68 +74,6 @@ public:
//- Destructor
virtual ~cyclicACMIGAMGInterface();
// Member Functions
// Interface transfer functions
//- Transfer and return internal field adjacent to the interface
virtual tmp<labelField> internalFieldTransfer
(
const Pstream::commsTypes commsType,
const labelUList& iF
) const;
//- Cyclic interface functions
//- Return neighbour processor number
virtual label neighbPatchID() const
{
return fineCyclicACMIInterface_.neighbPatchID();
}
virtual bool owner() const
{
return fineCyclicACMIInterface_.owner();
}
virtual const cyclicACMIGAMGInterface& neighbPatch() const
{
return dynamic_cast<const cyclicACMIGAMGInterface&>
(
coarseInterfaces_[neighbPatchID()]
);
}
virtual const AMIPatchToPatchInterpolation& AMI() const
{
return amiPtr_();
}
//- Return face transformation tensor
virtual const tensorField& forwardT() const
{
return fineCyclicACMIInterface_.forwardT();
}
//- Return neighbour-cell transformation tensor
virtual const tensorField& reverseT() const
{
return fineCyclicACMIInterface_.reverseT();
}
// I/O
//- Write to stream
virtual void write(Ostream&) const
{
//TBD. How to serialise the AMI such that we can stream
// cyclicACMIGAMGInterface.
NotImplemented;
}
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -63,7 +63,9 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface
fineCyclicAMIInterface_
(
refCast<const cyclicAMILduInterface>(fineInterface)
)
),
AMIs_(),
AMITransforms_()
{
// Construct face agglomeration from cell agglomeration
{
@ -151,20 +153,29 @@ Foam::cyclicAMIGAMGInterface::cyclicAMIGAMGInterface
nbrFaceRestrictAddressing.transfer(dynNbrFaceRestrictAddressing);
}
amiPtr_.reset
AMIs_.resize(fineCyclicAMIInterface_.AMIs().size());
AMITransforms_.resize(fineCyclicAMIInterface_.AMITransforms().size());
forAll(AMIs(), i)
{
AMIs_.set
(
i,
new AMIPatchToPatchInterpolation
(
fineCyclicAMIInterface_.AMI(),
fineCyclicAMIInterface_.AMIs()[i],
faceRestrictAddressing_,
nbrFaceRestrictAddressing
)
);
AMITransforms_[i] = fineCyclicAMIInterface_.AMITransforms()[i];
}
}
}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicAMIGAMGInterface::~cyclicAMIGAMGInterface()
{}
@ -180,6 +191,7 @@ Foam::tmp<Foam::labelField> Foam::cyclicAMIGAMGInterface::internalFieldTransfer
{
const cyclicAMIGAMGInterface& nbr =
dynamic_cast<const cyclicAMIGAMGInterface&>(neighbPatch());
const labelUList& nbrFaceCells = nbr.faceCells();
tmp<labelField> tpnf(new labelField(nbrFaceCells.size()));

View File

@ -58,8 +58,11 @@ class cyclicAMIGAMGInterface
// agglomerated
const cyclicAMILduInterface& fineCyclicAMIInterface_;
//- AMI interface
autoPtr<AMIPatchToPatchInterpolation> amiPtr_;
//- AMI interfaces
PtrList<AMIPatchToPatchInterpolation> AMIs_;
//- AMI transformations
List<vectorTensorTransform> AMITransforms_;
// Private Member Functions
@ -117,11 +120,13 @@ public:
return fineCyclicAMIInterface_.neighbPatchID();
}
//- Does this side own the interface?
virtual bool owner() const
{
return fineCyclicAMIInterface_.owner();
}
//- Return neighbour patch
virtual const cyclicAMIGAMGInterface& neighbPatch() const
{
return dynamic_cast<const cyclicAMIGAMGInterface&>
@ -130,9 +135,16 @@ public:
);
}
virtual const AMIPatchToPatchInterpolation& AMI() const
//- Return a reference to the AMI interpolators
virtual const PtrList<AMIPatchToPatchInterpolation>& AMIs() const
{
return amiPtr_();
return AMIs_;
}
// Return a reference to the AMI transformations
virtual const List<vectorTensorTransform>& AMITransforms() const
{
return AMITransforms_;
}
//- Return face transformation tensor

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "AMIInterpolation.H"
#include "cyclicRepeatAMIGAMGInterface.H"
#include "addToRunTimeSelectionTable.H"
#include "Map.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicRepeatAMIGAMGInterface, 0);
addToRunTimeSelectionTable
(
GAMGInterface,
cyclicRepeatAMIGAMGInterface,
lduInterface
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMIGAMGInterface::cyclicRepeatAMIGAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& localRestrictAddressing,
const labelField& neighbourRestrictAddressing,
const label fineLevelIndex,
const label coarseComm
)
:
cyclicAMIGAMGInterface
(
index,
coarseInterfaces,
fineInterface,
localRestrictAddressing,
neighbourRestrictAddressing,
fineLevelIndex,
coarseComm
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMIGAMGInterface::~cyclicRepeatAMIGAMGInterface()
{}
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMIGAMGInterface
Description
GAMG agglomerated repeat AMI interface.
SourceFiles
cyclicRepeatAMIGAMGInterface.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIGAMGInterface_H
#define cyclicRepeatAMIGAMGInterface_H
#include "cyclicAMIGAMGInterface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMIGAMGInterface Declaration
\*---------------------------------------------------------------------------*/
class cyclicRepeatAMIGAMGInterface
:
public cyclicAMIGAMGInterface
{
public:
//- Runtime type information
TypeName("cyclicRepeatAMI");
// Constructors
//- Construct from fine level interface,
// local and neighbour restrict addressing
cyclicRepeatAMIGAMGInterface
(
const label index,
const lduInterfacePtrsList& coarseInterfaces,
const lduInterface& fineInterface,
const labelField& restrictAddressing,
const labelField& neighbourRestrictAddressing,
const label fineLevelIndex,
const label coarseComm
);
//- Destructor
virtual ~cyclicRepeatAMIGAMGInterface();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,16 +40,4 @@ Foam::cyclicACMILduInterfaceField::~cyclicACMILduInterfaceField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::cyclicACMILduInterfaceField::transformCoupleField
(
scalarField& f,
const direction cmpt
) const
{
cyclicAMILduInterfaceField::transformCoupleField(f, cmpt);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,20 +66,6 @@ public:
//- Destructor
virtual ~cyclicACMILduInterfaceField();
// Member Functions
//- Transform given patch field
template<class Type>
void transformCoupleField(Field<Type>& f) const;
//- Transform given patch internal field
void transformCoupleField
(
scalarField& psiInternal,
const direction cmpt
) const;
};
@ -87,20 +73,6 @@ public:
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "tensorField.H"
template<class Type>
void Foam::cyclicACMILduInterfaceField::transformCoupleField
(
Field<Type>& f
) const
{
cyclicAMILduInterfaceField::transformCoupleField(f);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "cyclicACMIPointPatch.H"
#include "pointBoundaryMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -41,42 +40,6 @@ namespace Foam
}
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::cyclicACMIPointPatch::initGeometry(PstreamBuffers&)
{}
void Foam::cyclicACMIPointPatch::calcGeometry(PstreamBuffers&)
{}
void Foam::cyclicACMIPointPatch::initMovePoints
(
PstreamBuffers&,
const pointField&
)
{}
void Foam::cyclicACMIPointPatch::movePoints(PstreamBuffers&, const pointField&)
{}
void Foam::cyclicACMIPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
facePointPatch::initUpdateMesh(pBufs);
// cyclicACMIPointPatch::initGeometry(pBufs);
}
void Foam::cyclicACMIPointPatch::updateMesh(PstreamBuffers& pBufs)
{
facePointPatch::updateMesh(pBufs);
// cyclicACMIPointPatch::calcGeometry(pBufs);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cyclicACMIPointPatch::cyclicACMIPointPatch
@ -85,8 +48,7 @@ Foam::cyclicACMIPointPatch::cyclicACMIPointPatch
const pointBoundaryMesh& bm
)
:
coupledFacePointPatch(patch, bm),
cyclicACMIPolyPatch_(refCast<const cyclicACMIPolyPatch>(patch))
cyclicAMIPointPatch(patch, bm)
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,9 +35,8 @@ SourceFiles
#ifndef cyclicACMIPointPatch_H
#define cyclicACMIPointPatch_H
#include "coupledFacePointPatch.H"
#include "cyclicAMIPointPatch.H"
#include "cyclicACMIPolyPatch.H"
#include "pointBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,46 +49,8 @@ namespace Foam
class cyclicACMIPointPatch
:
public coupledFacePointPatch
public cyclicAMIPointPatch
{
// Private data
//- Local reference cast into the cyclic AMI patch
const cyclicACMIPolyPatch& cyclicACMIPolyPatch_;
// Private Member Functions
//- Disallow default construct as copy
cyclicACMIPointPatch(const cyclicACMIPointPatch&);
//- Disallow default assignment
void operator=(const cyclicACMIPointPatch&);
protected:
// Protected Member Functions
//- 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&, const pointField&);
//- Correct patches after moving points
virtual void movePoints(PstreamBuffers&, const pointField&);
//- Initialise the update of the patch topology
virtual void initUpdateMesh(PstreamBuffers&);
//- Update of the patch topology
virtual void updateMesh(PstreamBuffers&);
public:
//- Runtime type information
@ -108,54 +69,6 @@ public:
//- Destructor
virtual ~cyclicACMIPointPatch();
// Member Functions
//- Is patch 'coupled'. Note that on AMI the geometry is not
// coupled but the fields are!
virtual bool coupled() const
{
return false;
}
//- Return the constraint type this pointPatch implements.
virtual const word& constraintType() const
{
return type();
}
//- Return the underlying cyclicAMIPolyPatch
const cyclicACMIPolyPatch& cyclicACMIPatch() const
{
return cyclicACMIPolyPatch_;
}
//- Return neighbour point patch
const cyclicACMIPointPatch& neighbPatch() const
{
label patchi = cyclicACMIPolyPatch_.neighbPatchID();
const pointPatch& pp = this->boundaryMesh()[patchi];
return refCast<const cyclicACMIPointPatch>(pp);
}
//- Are the cyclic planes parallel
bool parallel() const
{
return cyclicACMIPolyPatch_.parallel();
}
//- Return face transformation tensor
const tensorField& forwardT() const
{
return cyclicACMIPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
const tensorField& reverseT() const
{
return cyclicACMIPolyPatch_.reverseT();
}
};

View File

@ -1,196 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicACMIPointPatchField.H"
#include "Swap.H"
#include "transformField.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
)
:
coupledPointPatchField<Type>(p, iF),
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{}
template<class Type>
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict
)
:
coupledPointPatchField<Type>(p, iF, dict),
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{
if (!isType<cyclicACMIPointPatch>(p))
{
FatalIOErrorInFunction
(
dict
) << "patch " << this->patch().index() << " not cyclicACMI type. "
<< "Patch type = " << p.type()
<< exit(FatalIOError);
}
}
template<class Type>
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
(
const cyclicACMIPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper& mapper
)
:
coupledPointPatchField<Type>(ptf, p, iF, mapper),
cyclicACMIPatch_(refCast<const cyclicACMIPointPatch>(p)),
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{
if (!isType<cyclicACMIPointPatch>(this->patch()))
{
FatalErrorInFunction
<< "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<class Type>
Foam::cyclicACMIPointPatchField<Type>::cyclicACMIPointPatchField
(
const cyclicACMIPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
)
:
coupledPointPatchField<Type>(ptf, iF),
cyclicACMIPatch_(ptf.cyclicACMIPatch_),
ppiPtr_(nullptr),
nbrPpiPtr_(nullptr)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::cyclicACMIPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes,
Field<Type>& pField
) const
{
if (cyclicACMIPatch_.cyclicACMIPatch().owner())
{
// We inplace modify pField. To prevent the other side (which gets
// evaluated at a later date) using already changed values we do
// all swaps on the side that gets evaluated first.
// Get neighbouring pointPatch
const cyclicACMIPointPatch& nbrPatch = cyclicACMIPatch_.neighbPatch();
// Get neighbouring pointPatchField
const GeometricField<Type, pointPatchField, pointMesh>& fld =
refCast<const GeometricField<Type, pointPatchField, pointMesh>>
(
this->internalField()
);
const cyclicACMIPointPatchField<Type>& nbr =
refCast<const cyclicACMIPointPatchField<Type>>
(
fld.boundaryField()[nbrPatch.index()]
);
Field<Type> ptFld(this->patchInternalField(pField));
Field<Type> nbrPtFld(nbr.patchInternalField(pField));
if (doTransform())
{
const tensor& forwardT = this->forwardT()[0];
const tensor& reverseT = this->reverseT()[0];
transform(ptFld, reverseT, ptFld);
transform(nbrPtFld, forwardT, nbrPtFld);
}
// convert point field to face field, AMI interpolate, then
// face back to point
{
// add neighbour side contribution to owner
Field<Type> nbrFcFld(nbrPpi().pointToFaceInterpolate(nbrPtFld));
const cyclicAMIPolyPatch& cami = cyclicACMIPatch_.cyclicACMIPatch();
// interpolate to owner
nbrFcFld = cami.interpolate(nbrFcFld);
// add to internal field
this->addToInternalField
(
pField,
ppi().faceToPointInterpolate(nbrFcFld)()
);
}
{
// add owner side contribution to neighbour
Field<Type> fcFld(ppi().pointToFaceInterpolate(ptFld));
const cyclicAMIPolyPatch& cami = cyclicACMIPatch_.cyclicACMIPatch();
// interpolate to neighbour
fcFld = cami.neighbPatch().cyclicAMIPolyPatch::interpolate(fcFld);
// add to internal field
nbr.addToInternalField
(
pField,
nbrPpi().faceToPointInterpolate(fcFld)()
);
}
}
}
// ************************************************************************* //

View File

@ -35,9 +35,8 @@ SourceFiles
#ifndef cyclicACMIPointPatchField_H
#define cyclicACMIPointPatchField_H
#include "coupledPointPatchField.H"
#include "cyclicAMIPointPatchField.H"
#include "cyclicACMIPointPatch.H"
#include "PrimitivePatchInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,58 +50,8 @@ namespace Foam
template<class Type>
class cyclicACMIPointPatchField
:
public coupledPointPatchField<Type>
public cyclicAMIPointPatchField<Type>
{
// Private data
//- Local reference cast into the cyclicACMI patch
const cyclicACMIPointPatch& cyclicACMIPatch_;
//- Owner side patch interpolation pointer
mutable autoPtr<PrimitivePatchInterpolation<primitivePatch>> ppiPtr_;
//- Neighbour side patch interpolation pointer
mutable autoPtr<PrimitivePatchInterpolation<primitivePatch>>
nbrPpiPtr_;
// Private Member Functions
//- Owner side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& ppi() const
{
if (!ppiPtr_.valid())
{
ppiPtr_.reset
(
new PrimitivePatchInterpolation<primitivePatch>
(
cyclicACMIPatch_.cyclicACMIPatch()
)
);
}
return ppiPtr_();
}
//- Neighbour side patch interpolation
const PrimitivePatchInterpolation<primitivePatch>& nbrPpi() const
{
if (!nbrPpiPtr_.valid())
{
nbrPpiPtr_.reset
(
new PrimitivePatchInterpolation<primitivePatch>
(
cyclicACMIPatch_.cyclicACMIPatch().neighbPatch()
)
);
}
return nbrPpiPtr_();
}
public:
//- Runtime type information
@ -111,29 +60,8 @@ public:
// Constructors
//- Construct from patch and internal field
cyclicACMIPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&
);
//- Construct from patch, internal field and dictionary
cyclicACMIPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
cyclicACMIPointPatchField
(
const cyclicACMIPointPatchField<Type>&,
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const pointPatchFieldMapper&
);
//- Inherit parent constructors
using cyclicAMIPointPatchField<Type>::cyclicAMIPointPatchField;
//- Construct and return a clone
virtual autoPtr<pointPatchField<Type>> clone() const
@ -147,13 +75,6 @@ public:
);
}
//- Construct as copy setting internal field reference
cyclicACMIPointPatchField
(
const cyclicACMIPointPatchField<Type>&,
const DimensionedField<Type, pointMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<pointPatchField<Type>> clone
(
@ -168,60 +89,6 @@ public:
)
);
}
// Member functions
// Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return cyclicACMIPointPatch::typeName;
}
// Cyclic AMI coupled interface functions
//- Does the patch field perform the transformation
virtual bool doTransform() const
{
return
!(
cyclicACMIPatch_.parallel()
|| pTraits<Type>::rank == 0
);
}
//- Return face transformation tensor
virtual const tensorField& forwardT() const
{
return cyclicACMIPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
virtual const tensorField& reverseT() const
{
return cyclicACMIPatch_.reverseT();
}
// Evaluation functions
//- Evaluate the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
)
{}
//- Complete swap of patch point values and add to local values
virtual void swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
};
@ -231,12 +98,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "cyclicACMIPointPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -64,32 +64,21 @@ void Foam::cyclicACMIPolyPatch::resetAMI() const
<< endl;
}
//WarningInFunction
// << "The mesh already has cellCentres calculated when"
// << " resetting ACMI " << name() << "." << endl
// << "This is a problem since ACMI adapts the face areas"
// << " (to close cells) so this has" << endl
// << "to be done before cell centre calculation." << endl
// << "This can happen if e.g. the cyclicACMI is after"
// << " any processor patches in the boundary." << endl;
const_cast<polyMesh&>
(
boundaryMesh().mesh()
).primitiveMesh::clearGeom();
}
// Trigger re-building of faceAreas
(void)boundaryMesh().mesh().faceAreas();
// Calculate the AMI using partial face-area-weighted. This leaves
// the weights as fractions of local areas (sum(weights) = 1 means
// face is fully covered)
cyclicAMIPolyPatch::resetAMI();
AMIPatchToPatchInterpolation& AMI =
const_cast<AMIPatchToPatchInterpolation&>(this->AMI());
AMIPatchToPatchInterpolation& AMI = this->AMIs_[0];
srcMask_ =
min(scalar(1) - tolerance_, max(tolerance_, AMI.srcWeightsSum()));
@ -174,11 +163,6 @@ void Foam::cyclicACMIPolyPatch::resetAMI() const
void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
if (debug)
{
Pout<< "cyclicACMIPolyPatch::initGeometry : " << name() << endl;
}
cyclicAMIPolyPatch::initGeometry(pBufs);
// Initialise the AMI
@ -186,26 +170,12 @@ void Foam::cyclicACMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
}
void Foam::cyclicACMIPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
if (debug)
{
Pout<< "cyclicACMIPolyPatch::calcGeometry : " << name() << endl;
}
cyclicAMIPolyPatch::calcGeometry(pBufs);
}
void Foam::cyclicACMIPolyPatch::initMovePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
if (debug)
{
Pout<< "cyclicACMIPolyPatch::initMovePoints : " << name() << endl;
}
cyclicAMIPolyPatch::initMovePoints(pBufs, p);
// Initialise the AMI
@ -213,50 +183,6 @@ void Foam::cyclicACMIPolyPatch::initMovePoints
}
void Foam::cyclicACMIPolyPatch::movePoints
(
PstreamBuffers& pBufs,
const pointField& p
)
{
if (debug)
{
Pout<< "cyclicACMIPolyPatch::movePoints : " << name() << endl;
}
cyclicAMIPolyPatch::movePoints(pBufs, p);
}
void Foam::cyclicACMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
if (debug)
{
Pout<< "cyclicACMIPolyPatch::initUpdateMesh : " << name() << endl;
}
cyclicAMIPolyPatch::initUpdateMesh(pBufs);
}
void Foam::cyclicACMIPolyPatch::updateMesh(PstreamBuffers& pBufs)
{
if (debug)
{
Pout<< "cyclicACMIPolyPatch::updateMesh : " << name() << endl;
}
cyclicAMIPolyPatch::updateMesh(pBufs);
}
void Foam::cyclicACMIPolyPatch::clearGeom()
{
if (debug)
{
Pout<< "cyclicACMIPolyPatch::clearGeom : " << name() << endl;
}
cyclicAMIPolyPatch::clearGeom();
}
const Foam::scalarField& Foam::cyclicACMIPolyPatch::srcMask() const
{
return srcMask_;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -86,24 +86,9 @@ protected:
//- 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&);
//- Clear geometry
virtual void clearGeom();
//- Return the mask/weighting for the source patch
virtual const scalarField& srcMask() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -74,12 +74,19 @@ public:
//- Return neighbour
virtual label neighbPatchID() const = 0;
//- Does this side own the interface?
virtual bool owner() const = 0;
//- Return processor number
virtual const cyclicAMILduInterface& neighbPatch() const = 0;
virtual const AMIPatchToPatchInterpolation& AMI() const = 0;
//- Return a reference to the AMI interpolators
virtual const PtrList<AMIPatchToPatchInterpolation>&
AMIs() const = 0;
// Return a reference to the AMI transformations
virtual const List<vectorTensorTransform>&
AMITransforms() const = 0;
//- Return face transformation tensor
virtual const tensorField& forwardT() const = 0;

View File

@ -287,8 +287,6 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const
{
if (owner())
{
AMIPtr_.clear();
const polyPatch& nbr = neighbPatch();
pointField nbrPoints
(
@ -326,8 +324,10 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const
}
// Construct/apply AMI interpolation to determine addressing and weights
AMIPtr_.reset
AMIs_.resize(1);
AMIs_.set
(
0,
new AMIPatchToPatchInterpolation
(
*this,
@ -341,13 +341,15 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const
)
);
AMITransforms_.resize(1, vectorTensorTransform::I);
if (debug)
{
Pout<< "cyclicAMIPolyPatch : " << name()
<< " constructed AMI with " << nl
<< " " << "srcAddress:" << AMIPtr_().srcAddress().size()
<< " " << "srcAddress:" << AMIs_[0].srcAddress().size()
<< nl
<< " " << "tgAddress :" << AMIPtr_().tgtAddress().size()
<< " " << "tgAddress :" << AMIs_[0].tgtAddress().size()
<< nl << endl;
}
}
@ -392,8 +394,9 @@ void Foam::cyclicAMIPolyPatch::calcTransforms()
void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
// Clear the invalid AMI
AMIPtr_.clear();
// Clear the invalid AMIs and transforms
AMIs_.clear();
AMITransforms_.clear();
polyPatch::initGeometry(pBufs);
}
@ -420,8 +423,9 @@ void Foam::cyclicAMIPolyPatch::initMovePoints
const pointField& p
)
{
// Clear the invalid AMI
AMIPtr_.clear();
// Clear the invalid AMIs and transforms
AMIs_.clear();
AMITransforms_.clear();
polyPatch::initMovePoints(pBufs, p);
@ -444,8 +448,9 @@ void Foam::cyclicAMIPolyPatch::movePoints
void Foam::cyclicAMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
{
// Clear the invalid AMI
AMIPtr_.clear();
// Clear the invalid AMIs and transforms
AMIs_.clear();
AMITransforms_.clear();
polyPatch::initUpdateMesh(pBufs);
}
@ -459,7 +464,10 @@ void Foam::cyclicAMIPolyPatch::updateMesh(PstreamBuffers& pBufs)
void Foam::cyclicAMIPolyPatch::clearGeom()
{
AMIPtr_.clear();
// Clear the invalid AMIs and transforms
AMIs_.clear();
AMITransforms_.clear();
polyPatch::clearGeom();
}
@ -487,7 +495,8 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(false),
rotationAngle_(0.0),
separationVector_(Zero),
AMIPtr_(nullptr),
AMIs_(),
AMITransforms_(),
AMIReverse_(false),
AMIRequireMatch_(AMIRequireMatch),
AMILowWeightCorrection_(-1.0),
@ -520,7 +529,8 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(false),
rotationAngle_(0.0),
separationVector_(Zero),
AMIPtr_(nullptr),
AMIs_(),
AMITransforms_(),
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
AMIRequireMatch_(AMIRequireMatch),
AMILowWeightCorrection_(dict.lookupOrDefault("lowWeightCorrection", -1.0)),
@ -618,7 +628,8 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIPtr_(nullptr),
AMIs_(),
AMITransforms_(),
AMIReverse_(pp.AMIReverse_),
AMIRequireMatch_(pp.AMIRequireMatch_),
AMILowWeightCorrection_(pp.AMILowWeightCorrection_),
@ -650,7 +661,8 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIPtr_(nullptr),
AMIs_(),
AMITransforms_(),
AMIReverse_(pp.AMIReverse_),
AMIRequireMatch_(pp.AMIRequireMatch_),
AMILowWeightCorrection_(pp.AMILowWeightCorrection_),
@ -689,7 +701,8 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
rotationAngleDefined_(pp.rotationAngleDefined_),
rotationAngle_(pp.rotationAngle_),
separationVector_(pp.separationVector_),
AMIPtr_(nullptr),
AMIs_(),
AMITransforms_(),
AMIReverse_(pp.AMIReverse_),
AMIRequireMatch_(pp.AMIRequireMatch_),
AMILowWeightCorrection_(pp.AMILowWeightCorrection_),
@ -788,21 +801,41 @@ Foam::cyclicAMIPolyPatch::surfPtr() const
}
const Foam::AMIPatchToPatchInterpolation& Foam::cyclicAMIPolyPatch::AMI() const
const Foam::PtrList<Foam::AMIPatchToPatchInterpolation>&
Foam::cyclicAMIPolyPatch::AMIs() const
{
if (!owner())
{
FatalErrorInFunction
<< "AMI interpolator only available to owner patch"
<< "AMI interpolators only available to owner patch"
<< abort(FatalError);
}
if (!AMIPtr_.valid())
if (AMIs_.empty())
{
resetAMI();
}
return AMIPtr_();
return AMIs_;
}
const Foam::List<Foam::vectorTensorTransform>&
Foam::cyclicAMIPolyPatch::AMITransforms() const
{
if (!owner())
{
FatalErrorInFunction
<< "AMI transforms only available to owner patch"
<< abort(FatalError);
}
if (AMIs_.empty())
{
resetAMI();
}
return AMITransforms_;
}
@ -810,11 +843,37 @@ bool Foam::cyclicAMIPolyPatch::applyLowWeightCorrection() const
{
if (owner())
{
return AMI().applyLowWeightCorrection();
return AMILowWeightCorrection_ > 0;
}
else
{
return neighbPatch().AMI().applyLowWeightCorrection();
return neighbPatch().AMILowWeightCorrection_ > 0;
}
}
const Foam::scalarField& Foam::cyclicAMIPolyPatch::weightsSum() const
{
if (owner())
{
return AMIs()[0].srcWeightsSum();
}
else
{
return neighbPatch().AMIs()[0].tgtWeightsSum();
}
}
const Foam::scalarField& Foam::cyclicAMIPolyPatch::neighbWeightsSum() const
{
if (owner())
{
return AMIs()[0].tgtWeightsSum();
}
else
{
return neighbPatch().AMIs()[0].srcWeightsSum();
}
}
@ -950,6 +1009,45 @@ void Foam::cyclicAMIPolyPatch::reverseTransformDirection
}
Foam::tmp<Foam::scalarField> Foam::cyclicAMIPolyPatch::interpolate
(
const scalarField& fld,
const direction cmpt,
const direction rank,
const scalarUList& defaultValues
) const
{
const cyclicAMIPolyPatch& nei = neighbPatch();
tmp<scalarField> result(new scalarField(size(), Zero));
if (owner())
{
forAll(AMIs(), i)
{
const scalar r =
pow(inv(AMITransforms()[i]).R()(cmpt, cmpt), rank);
result.ref() +=
AMIs()[i].interpolateToSource(r*fld, defaultValues);
}
}
else
{
forAll(nei.AMIs(), i)
{
const scalar r =
pow(nei.AMITransforms()[i].R()(cmpt, cmpt), rank);
result.ref() +=
nei.AMIs()[i].interpolateToTarget(r*fld, defaultValues);
}
}
return result;
}
void Foam::cyclicAMIPolyPatch::calcGeometry
(
const primitivePatch& referPatch,
@ -998,50 +1096,82 @@ bool Foam::cyclicAMIPolyPatch::order
}
Foam::label Foam::cyclicAMIPolyPatch::pointFace
Foam::labelPair Foam::cyclicAMIPolyPatch::pointAMIAndFace
(
const label facei,
const vector& n,
point& p
) const
{
point prt(p);
reverseTransformPosition(prt, facei);
point pt(p);
reverseTransformPosition(pt, facei);
vector nrt(n);
reverseTransformDirection(nrt, facei);
label nbrFacei = -1;
vector nt(n);
reverseTransformDirection(nt, facei);
if (owner())
{
nbrFacei = AMI().tgtPointFace
(
*this,
neighbPatch(),
nrt,
facei,
prt
);
}
else
forAll(AMIs(), i)
{
nbrFacei = neighbPatch().AMI().srcPointFace
(
neighbPatch(),
*this,
nrt,
facei,
prt
);
}
point ptt = AMITransforms()[i].transformPosition(pt);
const vector ntt = AMITransforms()[i].transform(nt);
const label nbrFacei =
AMIs()[i].tgtPointFace(*this, neighbPatch(), ntt, facei, ptt);
if (nbrFacei >= 0)
{
p = prt;
p = ptt;
return labelPair(i, nbrFacei);
}
}
}
else
{
forAll(neighbPatch().AMIs(), i)
{
point ptt =
neighbPatch().AMITransforms()[i].invTransformPosition(pt);
const vector ntt =
neighbPatch().AMITransforms()[i].invTransform(nt);
const label nbrFacei =
neighbPatch().AMIs()[i].srcPointFace
(
*this,
neighbPatch(),
ntt,
facei,
ptt
);
if (nbrFacei >= 0)
{
p = ptt;
return labelPair(i, nbrFacei);
}
}
}
return nbrFacei;
return labelPair(-1, -1);
}
Foam::label Foam::cyclicAMIPolyPatch::singlePatchProc() const
{
const cyclicAMIPolyPatch& patch = owner() ? *this : neighbPatch();
const label proc = patch.AMIs()[0].singlePatchProc();
for (label i = 1; i < patch.AMIs().size(); ++ i)
{
if (patch.AMIs()[i].singlePatchProc() != proc)
{
return -1;
}
}
return proc;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -105,8 +105,11 @@ protected:
vector separationVector_;
//- AMI interpolation class
mutable autoPtr<AMIPatchToPatchInterpolation> AMIPtr_;
//- AMI interpolation classes
mutable PtrList<AMIPatchToPatchInterpolation> AMIs_;
//- AMI transforms (from source to target)
mutable List<vectorTensorTransform> AMITransforms_;
//- Flag to indicate that slave patch should be reversed for AMI
const bool AMIReverse_;
@ -303,12 +306,22 @@ public:
//- Return a reference to the projection surface
const autoPtr<searchableSurface>& surfPtr() const;
//- Return a reference to the AMI interpolator
const AMIPatchToPatchInterpolation& AMI() const;
//- Return a reference to the AMI interpolators
const PtrList<AMIPatchToPatchInterpolation>& AMIs() const;
//- Return a reference to the AMI transforms
const List<vectorTensorTransform>& AMITransforms() const;
//- Return true if applying the low weight correction
bool applyLowWeightCorrection() const;
//- Return the weights sum for this patch
virtual const scalarField& weightsSum() const;
//- Return the weights sum for the neighbour patch
virtual const scalarField& neighbWeightsSum() const;
// Transformations
@ -364,14 +377,13 @@ public:
const UList<Type>& defaultValues = UList<Type>()
) const;
//- Low-level interpolate List
template<class Type, class CombineOp>
void interpolate
//- Interpolate field component
tmp<scalarField> interpolate
(
const UList<Type>& fld,
const CombineOp& cop,
List<Type>& result,
const UList<Type>& defaultValues = UList<Type>()
const scalarField& field,
const direction cmpt,
const direction rank,
const scalarUList& defaultValues = scalarUList()
) const;
@ -408,15 +420,19 @@ public:
labelList& rotation
) const;
//- Return face index on neighbour patch which shares point p
// following trajectory vector n
label pointFace
//- Return the transform and face indices on neighbour patch which
// shares point p following trajectory vector n
labelPair pointAMIAndFace
(
const label facei,
const vector& n,
point& p
) const;
//- Index of processor that holds all of both sides, or -1 if
// distributed
label singlePatchProc() const;
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,16 +32,38 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicAMIPolyPatch::interpolate
const UList<Type>& defaultValues
) const
{
const cyclicAMIPolyPatch& nei = neighbPatch();
tmp<Field<Type>> result(new Field<Type>(size(), Zero));
if (owner())
{
return AMI().interpolateToSource(fld, defaultValues);
forAll(AMIs(), i)
{
result.ref() +=
AMIs()[i].interpolateToSource
(
AMITransforms()[i].invTransform(fld),
defaultValues
);
}
}
else
{
return neighbPatch().AMI().interpolateToTarget(fld, defaultValues);
forAll(nei.AMIs(), i)
{
result.ref() +=
nei.AMIs()[i].interpolateToTarget
(
nei.AMITransforms()[i].transform(fld),
defaultValues
);
}
}
return result;
}
template<class Type>
Foam::tmp<Foam::Field<Type>> Foam::cyclicAMIPolyPatch::interpolate
@ -54,36 +76,4 @@ Foam::tmp<Foam::Field<Type>> Foam::cyclicAMIPolyPatch::interpolate
}
template<class Type, class CombineOp>
void Foam::cyclicAMIPolyPatch::interpolate
(
const UList<Type>& fld,
const CombineOp& cop,
List<Type>& result,
const UList<Type>& defaultValues
) const
{
if (owner())
{
AMI().interpolateToSource
(
fld,
cop,
result,
defaultValues
);
}
else
{
neighbPatch().AMI().interpolateToTarget
(
fld,
cop,
result,
defaultValues
);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMILduInterface.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicRepeatAMILduInterface, 0);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMILduInterface::~cyclicRepeatAMILduInterface()
{}
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMILduInterface
Description
An abstract base class for overlapping AMI coupled interfaces
SourceFiles
cyclicRepeatAMILduInterface.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMILduInterface_H
#define cyclicRepeatAMILduInterface_H
#include "cyclicAMILduInterface.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMILduInterface Declaration
\*---------------------------------------------------------------------------*/
class cyclicRepeatAMILduInterface
:
public cyclicAMILduInterface
{
public:
//- Runtime type information
TypeName("cyclicRepeatAMILduInterface");
// Constructors
//- Construct null
cyclicRepeatAMILduInterface()
{}
//- Destructor
virtual ~cyclicRepeatAMILduInterface();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMILduInterfaceField.H"
#include "diagTensorField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicRepeatAMILduInterfaceField, 0);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMILduInterfaceField::~cyclicRepeatAMILduInterfaceField()
{}
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMILduInterfaceField
Description
Abstract base class for overlapping AMI coupled interfaces
SourceFiles
cyclicRepeatAMILduInterfaceField.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMILduInterfaceField_H
#define cyclicRepeatAMILduInterfaceField_H
#include "cyclicAMILduInterfaceField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMILduInterfaceField Declaration
\*---------------------------------------------------------------------------*/
class cyclicRepeatAMILduInterfaceField
:
public cyclicAMILduInterfaceField
{
public:
//- Runtime type information
TypeName("cyclicRepeatAMILduInterfaceField");
// Constructors
//- Construct null
cyclicRepeatAMILduInterfaceField()
{}
//- Destructor
virtual ~cyclicRepeatAMILduInterfaceField();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,61 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMIPointPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicRepeatAMIPointPatch, 0);
addToRunTimeSelectionTable
(
facePointPatch,
cyclicRepeatAMIPointPatch,
polyPatch
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMIPointPatch::cyclicRepeatAMIPointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm
)
:
cyclicAMIPointPatch(patch, bm)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMIPointPatch::~cyclicRepeatAMIPointPatch()
{}
// ************************************************************************* //

View File

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMIPointPatch
Description
Repeat AMI point patch - place holder only
SourceFiles
cyclicRepeatAMIPointPatch.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIPointPatch_H
#define cyclicRepeatAMIPointPatch_H
#include "cyclicAMIPointPatch.H"
#include "cyclicRepeatAMIPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMIPointPatch Declaration
\*---------------------------------------------------------------------------*/
class cyclicRepeatAMIPointPatch
:
public cyclicAMIPointPatch
{
public:
//- Runtime type information
TypeName(cyclicRepeatAMIPolyPatch::typeName_());
// Constructors
//- Construct from components
cyclicRepeatAMIPointPatch
(
const polyPatch& patch,
const pointBoundaryMesh& bm
);
//- Destructor
virtual ~cyclicRepeatAMIPointPatch();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMIPointPatchField
Description
Repeat AMI front and back plane patch field
SourceFiles
cyclicRepeatAMIPointPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIPointPatchField_H
#define cyclicRepeatAMIPointPatchField_H
#include "cyclicAMIPointPatchField.H"
#include "cyclicRepeatAMIPointPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMIPointPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class cyclicRepeatAMIPointPatchField
:
public cyclicAMIPointPatchField<Type>
{
public:
//- Runtime type information
TypeName(cyclicRepeatAMIPointPatch::typeName_());
// Constructors
//- Inherit parent constructors
using cyclicAMIPointPatchField<Type>::cyclicAMIPointPatchField;
//- Construct and return a clone
virtual autoPtr<pointPatchField<Type>> clone() const
{
return autoPtr<pointPatchField<Type>>
(
new cyclicRepeatAMIPointPatchField<Type>
(
*this
)
);
}
//- Construct and return a clone setting internal field reference
virtual autoPtr<pointPatchField<Type>> clone
(
const DimensionedField<Type, pointMesh>& iF
) const
{
return autoPtr<pointPatchField<Type>>
(
new cyclicRepeatAMIPointPatchField<Type>
(
*this, iF
)
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMIPointPatchFields.H"
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(cyclicRepeatAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIPointPatchFields_H
#define cyclicRepeatAMIPointPatchFields_H
#include "cyclicRepeatAMIPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(cyclicRepeatAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,485 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "cyclicRepeatAMIPolyPatch.H"
#include "SubField.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(cyclicRepeatAMIPolyPatch, 0);
addToRunTimeSelectionTable(polyPatch, cyclicRepeatAMIPolyPatch, word);
addToRunTimeSelectionTable(polyPatch, cyclicRepeatAMIPolyPatch, dictionary);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
template <class Type>
class keepIfTrueOp
{
public:
Tuple2<bool, Type> operator()
(
const Tuple2<bool, Type>& x,
const Tuple2<bool, Type>& y
) const
{
if (x.first())
{
return x;
}
else if (y.first())
{
return y;
}
else
{
return Tuple2<bool, Type>(false, Type());
}
}
};
}
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
{
if (!owner())
{
return;
}
Info<< indent << typeName <<" : Creating addressing and weights between "
<< this->size() << " source faces and " << neighbPatch().size()
<< " target faces" << endl;
// Get the transform associated with the transform patch
vectorTensorTransform t;
{
const coupledPolyPatch& transformPatch = this->transformPatch();
if (transformPatch.name() != neighbPatch().transformPatch().name())
{
FatalErrorInFunction
<< "Transform patch " << transformPatch.name() << " for "
<< typeName << " patch " << name() << " is not the same as for "
<< "the neighbour patch " << neighbPatch().name() << ". "
<< "This is not allowed." << exit(FatalError);
}
if
(
transformPatch.separation().size() > 1
|| transformPatch.forwardT().size() > 1
)
{
FatalErrorInFunction
<< "Transform patch " << transformPatch.name() << " for "
<< typeName << " patch " << name() << " has a non-uniform "
<< "transformation. This is not allowed."
<< exit(FatalError);
}
Tuple2<bool, vectorTensorTransform> bt
(
transformPatch.size(),
vectorTensorTransform
(
transformPatch.separation().size() > 0
? transformPatch.separation()[0]
: vector::zero,
transformPatch.forwardT().size() > 0
? transformPatch.forwardT()[0]
: tensor::zero,
transformPatch.forwardT().size() > 0
)
);
reduce(bt, keepIfTrueOp<vectorTensorTransform>());
t = bt.second();
}
const vectorTensorTransform tInv(inv(t));
// Work out the number of repetitions of the transform that separate this
// patch from its neighbour
label n = 0;
{
const scalarField thisMagAreas(mag(this->faceAreas()));
const scalarField nbrMagAreas(mag(neighbPatch().faceAreas()));
vector thisCentre =
gSum(this->faceCentres()*thisMagAreas)/gSum(thisMagAreas);
vector nbrCentre =
gSum(neighbPatch().faceCentres()*nbrMagAreas)/gSum(nbrMagAreas);
scalar dLeft = mag(t.transformPosition(thisCentre) - nbrCentre);
scalar d = mag(thisCentre - nbrCentre);
scalar dRight = mag(tInv.transformPosition(thisCentre) - nbrCentre);
while (dLeft < d)
{
thisCentre = t.transformPosition(thisCentre);
dRight = d;
d = dLeft;
dLeft = mag(t.transformPosition(thisCentre) - nbrCentre);
++ n;
}
while (dRight < d)
{
thisCentre = tInv.transformPosition(thisCentre);
dLeft = d;
d = dRight;
dRight = mag(tInv.transformPosition(thisCentre) - nbrCentre);
-- n;
}
}
// Generate the full transformations
vectorTensorTransform TLeft(t), T(vectorTensorTransform::I), TRight(tInv);
if (n > 0)
{
for (label i = 0; i < n - 1; ++ i)
{
T = t & T;
}
TLeft = T;
T = t & T;
TRight = t & T;
}
if (n < 0)
{
for (label i = 0; i > n + 1; -- i)
{
T = tInv & T;
}
TRight = T;
T = tInv & T;
TLeft = tInv & T;
}
// Create copies of this patch and the neighbour patch's points
pointField thisPoints(localPoints());
const pointField nbrPoints(neighbPatch().localPoints());
// Create primitive patches
primitivePatch thisPatch
(
SubList<face>(localFaces(), size()),
thisPoints
);
primitivePatch nbrPatch
(
SubList<face>(neighbPatch().localFaces(), neighbPatch().size()),
nbrPoints
);
// Do the three bounding AMI interpolations
thisPoints = TLeft.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
autoPtr<AMIPatchToPatchInterpolation> AMILeftPtr
(
new AMIPatchToPatchInterpolation
(
thisPatch,
nbrPatch,
faceAreaIntersect::tmMesh,
false,
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight,
AMILowWeightCorrection_,
AMIReverse_,
false
)
);
const scalar sLeft =
gSum(AMILeftPtr->srcWeightsSum()*AMILeftPtr->srcMagSf())
/gSum(AMILeftPtr->srcMagSf());
thisPoints = T.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
autoPtr<AMIPatchToPatchInterpolation> AMIPtr
(
new AMIPatchToPatchInterpolation
(
thisPatch,
nbrPatch,
faceAreaIntersect::tmMesh,
false,
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight,
AMILowWeightCorrection_,
AMIReverse_,
false
)
);
const scalar s =
gSum(AMIPtr->srcWeightsSum()*AMIPtr->srcMagSf())
/gSum(AMIPtr->srcMagSf());
thisPoints = TRight.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
autoPtr<AMIPatchToPatchInterpolation> AMIRightPtr
(
new AMIPatchToPatchInterpolation
(
thisPatch,
nbrPatch,
faceAreaIntersect::tmMesh,
false,
AMIPatchToPatchInterpolation::imPartialFaceAreaWeight,
AMILowWeightCorrection_,
AMIReverse_,
false
)
);
const scalar sRight =
gSum(AMIRightPtr->srcWeightsSum()*AMIRightPtr->srcMagSf())
/gSum(AMIRightPtr->srcMagSf());
Info<< typeName << ": number of transforms = " << n << endl
<< typeName << ": left/centre/right sum(weights) = "
<< sLeft << ", " << s << ", " << sRight << endl;
// Set the AMI interpolators and transforms using the centre and the most
// overlapping of the left and right sides
AMIs_.resize(2);
AMIs_.set(0, sLeft > sRight ? AMILeftPtr.ptr() : AMIPtr.ptr());
AMIs_.set(1, sLeft > sRight ? AMIPtr.ptr() : AMIRightPtr.ptr());
AMITransforms_.resize(2);
AMITransforms_[0] = sLeft > sRight ? TLeft : T;
AMITransforms_[1] = sLeft > sRight ? T : TRight;
// Sum and normalise the two AMI interpolators
AMIPatchToPatchInterpolation::sumWeights(AMIs_);
AMIPatchToPatchInterpolation::reportSumWeights(AMIs_[0]);
AMIPatchToPatchInterpolation::normaliseWeights(AMIs_);
}
// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& patchType,
const transformType transform
)
:
cyclicAMIPolyPatch
(
name,
size,
start,
index,
bm,
patchType,
transform,
false,
AMIPatchToPatchInterpolation::imFaceAreaWeight
),
transformPatchName_(word::null),
transformPatchID_(-1)
{
// Transform patch might not be valid yet so cannot determine
// associated patchID
}
Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
)
:
cyclicAMIPolyPatch
(
name,
dict,
index,
bm,
patchType,
false,
AMIPatchToPatchInterpolation::imFaceAreaWeight
),
transformPatchName_(dict.lookup("transformPatch")),
transformPatchID_(-1)
{
// Transform patch might not be valid yet so cannot determine
// associated patchID
}
Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
(
const cyclicRepeatAMIPolyPatch& pp,
const polyBoundaryMesh& bm
)
:
cyclicAMIPolyPatch(pp, bm),
transformPatchName_(pp.transformPatchName_),
transformPatchID_(-1)
{
// Transform patch might not be valid yet so cannot determine
// associated patchID
}
Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
(
const cyclicRepeatAMIPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart,
const word& nbrPatchName
)
:
cyclicAMIPolyPatch(pp, bm, index, newSize, newStart, nbrPatchName),
transformPatchName_(pp.transformPatchName_),
transformPatchID_(-1)
{
// Transform patch might not be valid yet so cannot determine
// associated patchID
}
Foam::cyclicRepeatAMIPolyPatch::cyclicRepeatAMIPolyPatch
(
const cyclicRepeatAMIPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
)
:
cyclicAMIPolyPatch(pp, bm, index, mapAddressing, newStart),
transformPatchName_(pp.transformPatchName_),
transformPatchID_(-1)
{
// Transform patch might not be valid yet so cannot determine
// associated patchID
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::cyclicRepeatAMIPolyPatch::~cyclicRepeatAMIPolyPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::cyclicRepeatAMIPolyPatch&
Foam::cyclicRepeatAMIPolyPatch::neighbPatch() const
{
const polyPatch& pp = this->boundaryMesh()[neighbPatchID()];
return refCast<const cyclicRepeatAMIPolyPatch>(pp);
}
Foam::label Foam::cyclicRepeatAMIPolyPatch::transformPatchID() const
{
if (transformPatchID_ == -1)
{
transformPatchID_ =
this->boundaryMesh().findPatchID(transformPatchName());
if (transformPatchID_ == -1)
{
FatalErrorInFunction
<< "Illegal transformPatch name " << transformPatchName()
<< nl << "Valid patch names are "
<< this->boundaryMesh().names()
<< exit(FatalError);
}
}
return transformPatchID_;
}
const Foam::coupledPolyPatch&
Foam::cyclicRepeatAMIPolyPatch::transformPatch() const
{
const polyPatch& pp = this->boundaryMesh()[transformPatchID()];
return refCast<const coupledPolyPatch>(pp);
}
const Foam::scalarField& Foam::cyclicRepeatAMIPolyPatch::weightsSum() const
{
// The two AMI-interpolation classes have their weights summed together, so
// both should contain the same weights sum field. We can, therefore
// delegate to the base class and just return the weights sum of the first.
return cyclicAMIPolyPatch::weightsSum();
}
const Foam::scalarField&
Foam::cyclicRepeatAMIPolyPatch::neighbWeightsSum() const
{
// See above.
return cyclicAMIPolyPatch::neighbWeightsSum();
}
void Foam::cyclicRepeatAMIPolyPatch::write(Ostream& os) const
{
cyclicAMIPolyPatch::write(os);
os.writeKeyword("transformPatch") << transformPatchName_
<< token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,230 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::cyclicRepeatAMIPolyPatch
Description
Repeat patch for Arbitrary Mesh Interface (AMI)
SourceFiles
cyclicRepeatAMIPolyPatch.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicRepeatAMIPolyPatch_H
#define cyclicRepeatAMIPolyPatch_H
#include "cyclicAMIPolyPatch.H"
#include "AMIPatchToPatchInterpolation.H"
#include "polyBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicRepeatAMIPolyPatch Declaration
\*---------------------------------------------------------------------------*/
class cyclicRepeatAMIPolyPatch
:
public cyclicAMIPolyPatch
{
protected:
// Protected data
//- Name of the transform patch
mutable word transformPatchName_;
//- Index of the transform patch
mutable label transformPatchID_;
// Protected Member Functions
//- Reset the AMI interpolator
virtual void resetAMI() const;
public:
//- Runtime type information
TypeName("cyclicRepeatAMI");
// Constructors
//- Construct from (base couped patch) components
cyclicRepeatAMIPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& patchType,
const transformType transform = UNKNOWN
);
//- Construct from dictionary
cyclicRepeatAMIPolyPatch
(
const word& name,
const dictionary& dict,
const label index,
const polyBoundaryMesh& bm,
const word& patchType
);
//- Construct as copy, resetting the boundary mesh
cyclicRepeatAMIPolyPatch
(
const cyclicRepeatAMIPolyPatch&,
const polyBoundaryMesh&
);
//- Construct given the original patch and resetting the
// face list and boundary mesh information
cyclicRepeatAMIPolyPatch
(
const cyclicRepeatAMIPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart,
const word& nbrPatchName
);
//- Construct given the original patch and a map
cyclicRepeatAMIPolyPatch
(
const cyclicRepeatAMIPolyPatch& pp,
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
);
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{
return autoPtr<polyPatch>(new cyclicRepeatAMIPolyPatch(*this, bm));
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const label newSize,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new cyclicRepeatAMIPolyPatch
(
*this,
bm,
index,
newSize,
newStart,
nbrPatchName_
)
);
}
//- Construct and return a clone, resetting the face list
// and boundary mesh
virtual autoPtr<polyPatch> clone
(
const polyBoundaryMesh& bm,
const label index,
const labelUList& mapAddressing,
const label newStart
) const
{
return autoPtr<polyPatch>
(
new cyclicRepeatAMIPolyPatch
(
*this,
bm,
index,
mapAddressing,
newStart
)
);
}
//- Destructor
virtual ~cyclicRepeatAMIPolyPatch();
// Member Functions
// Access
//- Return a reference to the neighbour patch
virtual const cyclicRepeatAMIPolyPatch& neighbPatch() const;
//- Neighbour patch name
inline const word& transformPatchName() const;
//- Neighbour patch ID
virtual label transformPatchID() const;
//- Return a reference to the transform patch
virtual const coupledPolyPatch& transformPatch() const;
//- Return the weights sum for this patch
virtual const scalarField& weightsSum() const;
//- Return the weights sum for the neighbour patch
virtual const scalarField& neighbWeightsSum() const;
//- Write the polyPatch data as a dictionary
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "cyclicRepeatAMIPolyPatchI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::word&
Foam::cyclicRepeatAMIPolyPatch::transformPatchName() const
{
return transformPatchName_;
}
// ************************************************************************* //

View File

@ -225,6 +225,8 @@ $(AMI)/GAMG/interfaces/cyclicAMIGAMGInterface/cyclicAMIGAMGInterface.C
$(AMI)/GAMG/interfaceFields/cyclicAMIGAMGInterfaceField/cyclicAMIGAMGInterfaceField.C
$(AMI)/GAMG/interfaces/cyclicACMIGAMGInterface/cyclicACMIGAMGInterface.C
$(AMI)/GAMG/interfaceFields/cyclicACMIGAMGInterfaceField/cyclicACMIGAMGInterfaceField.C
$(AMI)/GAMG/interfaces/cyclicRepeatAMIGAMGInterface/cyclicRepeatAMIGAMGInterface.C
$(AMI)/GAMG/interfaceFields/cyclicRepeatAMIGAMGInterfaceField/cyclicRepeatAMIGAMGInterfaceField.C
AMICycPatches=$(AMI)/patches/cyclicAMI
$(AMICycPatches)/cyclicAMILduInterfaceField/cyclicAMILduInterface.C
@ -240,6 +242,13 @@ $(ACMICycPatches)/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C
$(ACMICycPatches)/cyclicACMIPointPatch/cyclicACMIPointPatch.C
$(ACMICycPatches)/cyclicACMIPointPatchField/cyclicACMIPointPatchFields.C
AMIOverlapPatches=$(AMI)/patches/cyclicRepeatAMI
$(AMIOverlapPatches)/cyclicRepeatAMILduInterfaceField/cyclicRepeatAMILduInterface.C
$(AMIOverlapPatches)/cyclicRepeatAMILduInterfaceField/cyclicRepeatAMILduInterfaceField.C
$(AMIOverlapPatches)/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C
$(AMIOverlapPatches)/cyclicRepeatAMIPointPatch/cyclicRepeatAMIPointPatch.C
$(AMIOverlapPatches)/cyclicRepeatAMIPointPatchField/cyclicRepeatAMIPointPatchFields.C
mappedPatches/mappedPolyPatch/mappedPatchBase.C
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C

View File

@ -483,6 +483,26 @@ void Foam::FaceCellWave<Type, TrackingData>::transform
}
template<class Type, class TrackingData>
void Foam::FaceCellWave<Type, TrackingData>::transform
(
const vectorTensorTransform& trans,
const label nFaces,
List<Type>& faceInfo
)
{
// Transform. Implementation referred to Type
if (trans.hasR())
{
for (label facei = 0; facei < nFaces; facei++)
{
faceInfo[facei].transform(mesh_, trans.R(), td_);
}
}
}
template<class Type, class TrackingData>
void Foam::FaceCellWave<Type, TrackingData>::offset
(
@ -750,18 +770,51 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
// Transfer sendInfo to cycPatch
combine<Type, TrackingData> cmb(*this, cycPatch);
List<Type> defVals;
if (cycPatch.applyLowWeightCorrection())
{
List<Type> defVals
(
cycPatch.patchInternalList(allCellInfo_)
);
defVals = cycPatch.patchInternalList(allCellInfo_);
}
cycPatch.interpolate(sendInfo, cmb, receiveInfo, defVals);
if (cycPatch.owner())
{
forAll(cycPatch.AMIs(), i)
{
List<Type> sendInfoT(sendInfo);
transform
(
cycPatch.AMITransforms()[i],
sendInfoT.size(),
sendInfoT
);
cycPatch.AMIs()[i].interpolateToSource
(
sendInfoT,
cmb,
receiveInfo,
defVals
);
}
}
else
{
cycPatch.interpolate(sendInfo, cmb, receiveInfo);
forAll(cycPatch.neighbPatch().AMIs(), i)
{
List<Type> sendInfoT(sendInfo);
transform
(
cycPatch.neighbPatch().AMITransforms()[i],
sendInfoT.size(),
sendInfoT
);
cycPatch.neighbPatch().AMIs()[i].interpolateToTarget
(
sendInfoT,
cmb,
receiveInfo,
defVals
);
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -60,6 +60,7 @@ namespace Foam
// Forward declaration of classes
class polyMesh;
class polyPatch;
class vectorTensorTransform;
/*---------------------------------------------------------------------------*\
Class FaceCellWaveName Declaration
@ -228,6 +229,14 @@ protected:
List<Type>& faceInfo
);
//- Apply transformation to Type
void transform
(
const vectorTensorTransform& trans,
const label nFaces,
List<Type>& faceInfo
);
//- Merge data from across processor boundaries
void handleProcPatches();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ Foam::regionCoupledGAMGInterfaceField::regionCoupledGAMGInterfaceField
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionCoupledGAMGInterfaceField::~regionCoupledGAMGInterfaceField()
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -78,7 +78,7 @@ Foam::regionCoupledWallGAMGInterfaceField::regionCoupledWallGAMGInterfaceField
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionCoupledWallGAMGInterfaceField::~regionCoupledWallGAMGInterfaceField
()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -202,7 +202,7 @@ Foam::regionCoupledBaseGAMGInterface::regionCoupledBaseGAMGInterface
}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionCoupledBaseGAMGInterface::~regionCoupledBaseGAMGInterface()
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,7 +66,7 @@ Foam::regionCoupledGAMGInterface::regionCoupledGAMGInterface
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionCoupledGAMGInterface::~regionCoupledGAMGInterface()
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,7 +66,7 @@ Foam::regionCoupledWallGAMGInterface::regionCoupledWallGAMGInterface
{}
// * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::regionCoupledWallGAMGInterface::~regionCoupledWallGAMGInterface()
{}

View File

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(inlet|outlet)"
{
type pressureInletOutletVelocity;
value $internalField;
}
stationaryWalls
{
type noSlip;
}
movingWalls
{
type movingWallVelocity;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object epsilon;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -3 0 0 0 0];
internalField uniform 0.0002025;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(inlet|outlet)"
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
wall
{
type epsilonWallFunction;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,41 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object k;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0.00015;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(inlet|outlet)"
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}
wall
{
type kqRWallFunction;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object nut;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -1 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(inlet|outlet)"
{
type calculated;
value uniform 0;
}
wall
{
type nutkWallFunction;
value uniform 0;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,40 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 2 -2 0 0 0 0];
internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
"(inlet|outlet)"
{
type totalPressure;
p0 $internalField;
value $internalField;
}
wall
{
type fixedFluxPressure;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,13 @@
#!/bin/sh
cd "${0%/*}" || exit 1
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication blockMesh
runApplication decomposePar
runParallel $(getApplication)
runApplication reconstructPar

View File

@ -0,0 +1,31 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolver solidBody;
cellZone rotating;
solidBodyMotionFunction rotatingMotion;
origin (0 0 0);
axis (1 0 0);
omega 6.2832;
// ************************************************************************* //

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
transportModel Newtonian;
nu [0 2 -1 0 0 0 0] 1e-05;
// ************************************************************************* //

View File

@ -0,0 +1,30 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RAS;
RAS
{
RASModel kEpsilon;
turbulence on;
printCoeffs on;
}
// ************************************************************************* //

View File

@ -0,0 +1,211 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.01;
r1 4;
r2 6;
r3 8;
r4 10;
y1 3.86370330516;
y2 5.79555495773;
y3 7.72740661031;
y4 9.65925826289;
nz1 -1.03527618041;
nz2 -1.55291427062;
nz3 -2.07055236082;
nz4 -2.58819045103;
pz1 1.03527618041;
pz2 1.55291427062;
pz3 2.07055236082;
pz4 2.58819045103;
vertices
(
(0 $y1 $nz1) (2 $y1 $nz1) (4 $y1 $nz1) (4 $y1 $nz1) (6 $y1 $nz1)
(0 $y2 $nz2) (2 $y2 $nz2) (4 $y2 $nz2) (4 $y2 $nz2) (6 $y2 $nz2)
(0 $y3 $nz3) (2 $y3 $nz3)
(0 $y3 $nz3) (2 $y3 $nz3)
(0 $y4 $nz4) (2 $y4 $nz4)
(0 $y1 $pz1) (2 $y1 $pz1) (4 $y1 $pz1) (4 $y1 $pz1) (6 $y1 $pz1)
(0 $y2 $pz2) (2 $y2 $pz2) (4 $y2 $pz2) (4 $y2 $pz2) (6 $y2 $pz2)
(0 $y3 $pz3) (2 $y3 $pz3)
(0 $y3 $pz3) (2 $y3 $pz3)
(0 $y4 $pz4) (2 $y4 $pz4)
);
blocks
(
hex ( 0 1 6 5 16 17 22 21) rotating (11 11 17) simpleGrading (1 1 1)
hex ( 1 2 7 6 17 18 23 22) rotating (11 11 17) simpleGrading (1 1 1)
hex ( 3 4 9 8 19 20 25 24) (10 10 16) simpleGrading (1 1 1)
hex ( 5 6 11 10 21 22 27 26) rotating (11 11 17) simpleGrading (1 1 1)
hex (12 13 15 14 28 29 31 30) (10 10 16) simpleGrading (1 1 1)
);
edges
(
arc 0 16 (0 $r1 0)
arc 1 17 (2 $r1 0)
arc 2 18 (4 $r1 0)
arc 3 19 (4 $r1 0)
arc 4 20 (6 $r1 0)
arc 5 21 (0 $r2 0)
arc 6 22 (2 $r2 0)
arc 7 23 (4 $r2 0)
arc 8 24 (4 $r2 0)
arc 9 25 (6 $r2 0)
arc 10 26 (0 $r3 0)
arc 11 27 (2 $r3 0)
arc 12 28 (0 $r3 0)
arc 13 29 (2 $r3 0)
arc 14 30 (0 $r4 0)
arc 15 31 (2 $r4 0)
);
defaultPatch
{
name movingWalls;
type wall;
}
boundary
(
stationaryWalls
{
type wall;
faces
(
(3 4 20 19)
(8 9 25 24)
(12 14 30 28)
(13 15 31 29)
);
}
inlet
{
type patch;
faces
(
(4 9 25 20)
);
}
outlet
{
type patch;
faces
(
(14 15 31 30)
);
}
cyclicIn1
{
type cyclic;
neighbourPatch cyclicIn2;
faces
(
(3 4 9 8)
);
}
cyclicIn2
{
type cyclic;
neighbourPatch cyclicIn1;
faces
(
(19 20 25 24)
);
}
cyclicRepeatAMIIn1
{
type cyclicRepeatAMI;
neighbourPatch cyclicRepeatAMIIn2;
transformPatch cyclicIn1;
faces
(
(3 8 24 19)
);
}
cyclicRepeatAMIIn2
{
type cyclicRepeatAMI;
neighbourPatch cyclicRepeatAMIIn1;
transformPatch cyclicIn1;
faces
(
(2 7 23 18)
);
}
cyclicOut1
{
type cyclic;
neighbourPatch cyclicOut2;
faces
(
(12 14 15 13)
);
}
cyclicOut2
{
type cyclic;
neighbourPatch cyclicOut1;
faces
(
(28 30 31 29)
);
}
cyclicRepeatAMIOut1
{
type cyclicRepeatAMI;
neighbourPatch cyclicRepeatAMIOut2;
transformPatch cyclicIn1;
faces
(
(10 11 27 26)
);
}
cyclicRepeatAMIOut2
{
type cyclicRepeatAMI;
neighbourPatch cyclicRepeatAMIOut1;
transformPatch cyclicIn1;
faces
(
(12 13 29 28)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application pimpleFoam;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 5;
deltaT 1e-3;
writeControl adjustableRunTime;
writeInterval 0.05;
purgeWrite 0;
writeFormat binary;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
adjustTimeStep yes;
maxCo 1.0;
// ************************************************************************* //

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method scotch;
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
grad(U) cellLimited Gauss linear 1;
}
divSchemes
{
default none;
div(phi,U) Gauss linearUpwind grad(U);
div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,76 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"pcorr.*"
{
solver GAMG;
smoother DICGaussSeidel;
tolerance 0.1;
relTol 0;
}
p
{
$pcorr;
tolerance 1e-06;
relTol 0.01;
}
pFinal
{
$p;
relTol 0;
}
"(U|k|epsilon)"
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-06;
relTol 0.01;
}
"(U|k|epsilon)Final"
{
$U;
relTol 0;
}
}
PIMPLE
{
correctPhi yes;
nOuterCorrectors 2;
nCorrectors 1;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* //