From 785a7d9e3f9b4bd19be519caaf29439fac374a60 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Mon, 9 Apr 2018 14:39:42 +0100 Subject: [PATCH] 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 --- .../manipulation/checkMesh/checkGeometry.C | 228 ++++---- .../manipulation/checkMesh/checkGeometry.H | 12 + .../manipulation/moveDynamicMesh/Make/files | 2 + .../manipulation/moveDynamicMesh/Make/options | 4 +- .../moveDynamicMesh/moveDynamicMesh.C | 113 +--- etc/caseDicts/setConstraintTypes | 5 + .../cyclicGAMGInterfaceField.C | 4 +- .../cyclicGAMGInterface/cyclicGAMGInterface.C | 4 +- .../processorCyclicGAMGInterface.C | 4 +- src/finiteVolume/Make/files | 3 + .../cyclicRepeatAMIFvPatchField.H | 119 +++++ .../cyclicRepeatAMIFvPatchFields.C | 43 ++ .../cyclicRepeatAMIFvPatchFields.H | 49 ++ .../cyclicRepeatAMIFvPatchFieldsFwd.H | 50 ++ .../cyclicRepeatAMIFvsPatchField.H | 97 ++++ .../cyclicRepeatAMIFvsPatchFields.C | 44 ++ .../cyclicRepeatAMIFvsPatchFields.H | 49 ++ .../cyclicRepeatAMIFvsPatchFieldsFwd.H | 50 ++ .../constraint/cyclicACMI/cyclicACMIFvPatch.H | 23 +- .../constraint/cyclicAMI/cyclicAMIFvPatch.H | 15 +- .../cyclicRepeatAMI/cyclicRepeatAMIFvPatch.C | 38 ++ .../cyclicRepeatAMI/cyclicRepeatAMIFvPatch.H | 78 +++ src/lagrangian/basic/Cloud/Cloud.C | 5 +- src/lagrangian/basic/particle/particle.H | 11 + .../basic/particle/particleTemplates.C | 36 +- .../AMIInterpolation/AMIInterpolation.C | 404 +++++++++------ .../AMIInterpolation/AMIInterpolation.H | 117 ++++- .../AMIMethod/directAMI/directAMI.C | 6 +- .../faceAreaWeightAMI/faceAreaWeightAMI.C | 20 +- .../AMIMethod/mapNearestAMI/mapNearestAMI.C | 6 +- .../sweptFaceAreaWeightAMI.H | 2 +- .../cyclicACMIGAMGInterfaceField.C | 60 +-- .../cyclicACMIGAMGInterfaceField.H | 79 +-- .../cyclicAMIGAMGInterfaceField.C | 44 +- .../cyclicRepeatAMIGAMGInterfaceField.C | 79 +++ .../cyclicRepeatAMIGAMGInterfaceField.H | 90 ++++ .../cyclicACMIGAMGInterface.C | 141 +---- .../cyclicACMIGAMGInterface.H | 87 +--- .../cyclicAMIGAMGInterface.C | 34 +- .../cyclicAMIGAMGInterface.H | 20 +- .../cyclicRepeatAMIGAMGInterface.C | 77 +++ .../cyclicRepeatAMIGAMGInterface.H | 88 ++++ .../cyclicACMILduInterfaceField.C | 14 +- .../cyclicACMILduInterfaceField.H | 30 +- .../cyclicACMIPointPatch.C | 42 +- .../cyclicACMIPointPatch.H | 93 +--- .../cyclicACMIPointPatchField.C | 196 ------- .../cyclicACMIPointPatchField.H | 147 +----- .../cyclicACMIPolyPatch/cyclicACMIPolyPatch.C | 76 +-- .../cyclicACMIPolyPatch/cyclicACMIPolyPatch.H | 17 +- .../cyclicAMILduInterface.H | 11 +- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.C | 228 ++++++-- .../cyclicAMIPolyPatch/cyclicAMIPolyPatch.H | 46 +- .../cyclicAMIPolyPatchTemplates.C | 60 +-- .../cyclicRepeatAMILduInterface.C | 42 ++ .../cyclicRepeatAMILduInterface.H | 80 +++ .../cyclicRepeatAMILduInterfaceField.C | 43 ++ .../cyclicRepeatAMILduInterfaceField.H | 80 +++ .../cyclicRepeatAMIPointPatch.C | 61 +++ .../cyclicRepeatAMIPointPatch.H | 83 +++ .../cyclicRepeatAMIPointPatchField.H | 103 ++++ .../cyclicRepeatAMIPointPatchFields.C | 43 ++ .../cyclicRepeatAMIPointPatchFields.H | 49 ++ .../cyclicRepeatAMIPolyPatch.C | 485 ++++++++++++++++++ .../cyclicRepeatAMIPolyPatch.H | 230 +++++++++ .../cyclicRepeatAMIPolyPatchI.H | 35 ++ src/meshTools/Make/files | 9 + .../algorithms/MeshWave/FaceCellWave.C | 65 ++- .../algorithms/MeshWave/FaceCellWave.H | 11 +- .../regionCoupledGAMGInterfaceField.C | 4 +- .../regionCoupledWallGAMGInterfaceField.C | 4 +- .../regionCoupledBaseGAMGInterface.C | 4 +- .../regionCoupledGAMGInterface.C | 4 +- .../regionCoupledWallGAMGInterface.C | 4 +- .../pimpleFoam/RAS/impeller/0/U | 45 ++ .../pimpleFoam/RAS/impeller/0/epsilon | 41 ++ .../pimpleFoam/RAS/impeller/0/k | 41 ++ .../pimpleFoam/RAS/impeller/0/nut | 40 ++ .../pimpleFoam/RAS/impeller/0/p | 40 ++ .../pimpleFoam/RAS/impeller/Allrun | 13 + .../RAS/impeller/constant/dynamicMeshDict | 31 ++ .../RAS/impeller/constant/transportProperties | 23 + .../impeller/constant/turbulenceProperties | 30 ++ .../RAS/impeller/system/blockMeshDict | 211 ++++++++ .../RAS/impeller/system/controlDict | 53 ++ .../RAS/impeller/system/decomposeParDict | 23 + .../pimpleFoam/RAS/impeller/system/fvSchemes | 55 ++ .../pimpleFoam/RAS/impeller/system/fvSolution | 76 +++ 88 files changed, 4017 insertions(+), 1544 deletions(-) create mode 100644 src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchField.H create mode 100644 src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.C create mode 100644 src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.H create mode 100644 src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFieldsFwd.H create mode 100644 src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchField.H create mode 100644 src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.C create mode 100644 src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.H create mode 100644 src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFieldsFwd.H create mode 100644 src/finiteVolume/fvMesh/fvPatches/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.C create mode 100644 src/finiteVolume/fvMesh/fvPatches/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.H create mode 100644 src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicRepeatAMIGAMGInterfaceField/cyclicRepeatAMIGAMGInterfaceField.C create mode 100644 src/meshTools/AMIInterpolation/GAMG/interfaceFields/cyclicRepeatAMIGAMGInterfaceField/cyclicRepeatAMIGAMGInterfaceField.H create mode 100644 src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicRepeatAMIGAMGInterface/cyclicRepeatAMIGAMGInterface.C create mode 100644 src/meshTools/AMIInterpolation/GAMG/interfaces/cyclicRepeatAMIGAMGInterface/cyclicRepeatAMIGAMGInterface.H delete mode 100644 src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPointPatchField/cyclicACMIPointPatchField.C create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMILduInterfaceField/cyclicRepeatAMILduInterface.C create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMILduInterfaceField/cyclicRepeatAMILduInterface.H create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMILduInterfaceField/cyclicRepeatAMILduInterfaceField.C create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMILduInterfaceField/cyclicRepeatAMILduInterfaceField.H create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPointPatch/cyclicRepeatAMIPointPatch.C create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPointPatch/cyclicRepeatAMIPointPatch.H create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPointPatchField/cyclicRepeatAMIPointPatchField.H create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPointPatchField/cyclicRepeatAMIPointPatchFields.C create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPointPatchField/cyclicRepeatAMIPointPatchFields.H create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.H create mode 100644 src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatchI.H create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/0/U create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/0/epsilon create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/0/k create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/0/nut create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/0/p create mode 100755 tutorials/incompressible/pimpleFoam/RAS/impeller/Allrun create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/constant/dynamicMeshDict create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/constant/transportProperties create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/constant/turbulenceProperties create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/system/blockMeshDict create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/system/controlDict create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/system/decomposeParDict create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/system/fvSchemes create mode 100644 tutorials/incompressible/pimpleFoam/RAS/impeller/system/fvSolution diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 6b4e17d74..005974885 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -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 globalPoints; + autoPtr 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(pbm[patchi])) + { + const cyclicAMIPolyPatch& cpp = + refCast(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 patchWriter; - if (!surfWriter.valid()) - { - patchWriter.reset(new vtkSurfaceWriter()); - } - const surfaceWriter& wr = - ( - surfWriter.valid() - ? surfWriter() - : patchWriter() - ); - - forAll(pbm, patchi) - { - if (isA(pbm[patchi])) - { - const cyclicAMIPolyPatch& cpp = - refCast(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 globalPoints; - autoPtr 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 globalPoints; - autoPtr 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; diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.H b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.H index d0111fd1e..4056bf4b5 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.H +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.H @@ -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, diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/files b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/files index bee2b8d28..8572a5664 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/files +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/files @@ -1,3 +1,5 @@ moveDynamicMesh.C +../checkMesh/checkGeometry.C +../checkMesh/checkTools.C EXE = $(FOAM_APPBIN)/moveDynamicMesh diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options index f7e149613..5dbb0c35a 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options @@ -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 \ diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C index 413524933..8e7e980f5 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C @@ -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 globalPoints; - autoPtr 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(pbm[patchi])) - { - const cyclicAMIPolyPatch& cpp = - refCast(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(); diff --git a/etc/caseDicts/setConstraintTypes b/etc/caseDicts/setConstraintTypes index 9326eff70..c9e5cecd7 100644 --- a/etc/caseDicts/setConstraintTypes +++ b/etc/caseDicts/setConstraintTypes @@ -37,6 +37,11 @@ nonuniformTransformCyclic type nonuniformTransformCyclic; } +cyclicRepeatAMI +{ + type cyclicRepeatAMI; +} + processor { type processor; diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C index 6eebf5f60..31ce01394 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaceFields/cyclicGAMGInterfaceField/cyclicGAMGInterfaceField.C @@ -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() {} diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.C index 7f884c205..c3e964860 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/cyclicGAMGInterface/cyclicGAMGInterface.C @@ -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() {} diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C index 5f7171dbd..0fac210e6 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/interfaces/processorCyclicGAMGInterface/processorCyclicGAMGInterface.C @@ -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() {} diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 4efe69cee..a4d470564 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -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 diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchField.H new file mode 100644 index 000000000..99d4f80f9 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchField.H @@ -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 . + +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 + + { + 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 cyclicRepeatAMIFvPatchField +: + public cyclicAMIFvPatchField +{ +public: + + //- Runtime type information + TypeName(cyclicRepeatAMIFvPatch::typeName_()); + + + // Constructors + + //- Inherit parent constructors + using cyclicAMIFvPatchField::cyclicAMIFvPatchField; + + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp> + ( + new cyclicRepeatAMIFvPatchField(*this) + ); + } + + //- Construct and return a clone setting internal field reference + virtual tmp> clone + ( + const DimensionedField& iF + ) const + { + return tmp> + ( + new cyclicRepeatAMIFvPatchField(*this, iF) + ); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.C new file mode 100644 index 000000000..612a23e76 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "cyclicRepeatAMIFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(cyclicRepeatAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.H new file mode 100644 index 000000000..5401a291a --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFields.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef cyclicRepeatAMIFvPatchFields_H +#define cyclicRepeatAMIFvPatchFields_H + +#include "cyclicRepeatAMIFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(cyclicRepeatAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFieldsFwd.H new file mode 100644 index 000000000..da78be032 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatchFieldsFwd.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef cyclicRepeatAMIFvPatchFieldsFwd_H +#define cyclicRepeatAMIFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class cyclicRepeatAMIFvPatchField; + +makePatchTypeFieldTypedefs(cyclicRepeatAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchField.H new file mode 100644 index 000000000..0c8e9f50c --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchField.H @@ -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 . + +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 cyclicRepeatAMIFvsPatchField +: + public cyclicAMIFvsPatchField +{ +public: + + //- Runtime type information + TypeName(cyclicRepeatAMIFvPatch::typeName_()); + + + // Constructors + + //- Inherit parent constructors + using cyclicAMIFvsPatchField::cyclicAMIFvsPatchField; + + //- Construct and return a clone + virtual tmp> clone() const + { + return tmp> + ( + new cyclicRepeatAMIFvsPatchField(*this) + ); + } + + //- Construct and return a clone setting internal field reference + virtual tmp> clone + ( + const DimensionedField& iF + ) const + { + return tmp> + ( + new cyclicRepeatAMIFvsPatchField(*this, iF) + ); + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.C b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.C new file mode 100644 index 000000000..1a406ce17 --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "cyclicRepeatAMIFvsPatchFields.H" +#include "fvsPatchFields.H" +#include "surfaceMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeFvsPatchFields(cyclicRepeatAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.H b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.H new file mode 100644 index 000000000..18d82fb54 --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFields.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef cyclicRepeatAMIFvsPatchFields_H +#define cyclicRepeatAMIFvsPatchFields_H + +#include "cyclicRepeatAMIFvsPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeFvsPatchTypeFieldTypedefs(cyclicRepeatAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFieldsFwd.H b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFieldsFwd.H new file mode 100644 index 000000000..9988848d0 --- /dev/null +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvsPatchFieldsFwd.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef cyclicRepeatAMIFvsPatchFieldsFwd_H +#define cyclicRepeatAMIFvsPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class cyclicRepeatAMIFvsPatchField; + +makeFvsPatchTypeFieldTypedefs(cyclicRepeatAMI); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicACMI/cyclicACMIFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicACMI/cyclicACMIFvPatch.H index 048ee6141..2b5b5bdba 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicACMI/cyclicACMIFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicACMI/cyclicACMIFvPatch.H @@ -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& AMIs() const { - const AMIPatchToPatchInterpolation& AMI = - cyclicACMIPolyPatch_.AMI(); + const PtrList& AMIs = + cyclicACMIPolyPatch_.AMIs(); updateAreas(); - return AMI; + return AMIs; + } + + //- Return a reference to the AMI transformations + virtual const List& AMITransforms() const + { + const List& AMITransforms = + cyclicACMIPolyPatch_.AMITransforms(); + + updateAreas(); + + return AMITransforms; } //- Are the cyclic planes parallel diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H index 0f7553734..5dba5fe49 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicAMI/cyclicAMIFvPatch.H @@ -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& AMIs() const { - return cyclicAMIPolyPatch_.AMI(); + return cyclicAMIPolyPatch_.AMIs(); + } + + //- Return a reference to the AMI transforms + virtual const List& 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 { diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.C new file mode 100644 index 000000000..9981b490b --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "cyclicRepeatAMIFvPatch.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(cyclicRepeatAMIFvPatch, 0); + addToRunTimeSelectionTable(fvPatch, cyclicRepeatAMIFvPatch, polyPatch); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.H b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.H new file mode 100644 index 000000000..05a3bf025 --- /dev/null +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/cyclicRepeatAMI/cyclicRepeatAMIFvPatch.H @@ -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 . + +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 + +// ************************************************************************* // diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 4d9675169..aa81d83b6 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -47,10 +47,7 @@ void Foam::Cloud::checkPatches() const const cyclicAMIPolyPatch& cami = refCast(pbm[patchi]); - if (cami.owner()) - { - ok = ok && (cami.AMI().singlePatchProc() != -1); - } + ok = ok && cami.singlePatchProc() != -1; } } diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H index 8e84ed408..5225191cd 100644 --- a/src/lagrangian/basic/particle/particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -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 void hitCyclicACMIPatch(TrackCloudType&, trackingData&, const vector&); + //- Overridable function to handle the particle hitting an + // cyclicRepeatAMIPolyPatch + template + void hitCyclicRepeatAMIPatch + ( + TrackCloudType&, + trackingData&, + const vector& + ); + //- Overridable function to handle the particle hitting a processorPatch template void hitProcessorPatch(TrackCloudType&, trackingData&); diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index 7a809c5fe..6b7e828c8 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -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(patch)) + { + p.hitCyclicRepeatAMIPatch(cloud, ttd, direction); + } else if (isA(patch)) { p.hitProcessorPatch(cloud, ttd); @@ -276,7 +281,9 @@ void Foam::particle::hitCyclicAMIPatch static_cast(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 +void Foam::particle::hitCyclicRepeatAMIPatch +( + TrackCloudType& cloud, + trackingData& td, + const vector& direction +) +{ + hitCyclicAMIPatch(cloud, td, direction); +} + + template void Foam::particle::hitProcessorPatch(TrackCloudType&, trackingData&) {} diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 8045bb07d..e1e209858 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -221,79 +221,118 @@ void Foam::AMIInterpolation::projectPointsToSurface template -void Foam::AMIInterpolation::normaliseWeights +void Foam::AMIInterpolation::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) + { + wghtSum[facei] = sum(wght[facei]); + } +} + + +template +void Foam::AMIInterpolation::sumWeights +( + const UPtrList& wghts, + scalarField& wghtSum +) +{ + wghtSum.setSize(wghts[0].size()); + wghtSum = Zero; + + forAll(wghts[0], facei) + { + forAll(wghts, wghtsi) + { + forAll(wghts[wghtsi][facei], i) + { + wghtSum[facei] += wghts[wghtsi][facei][i]; + } + } + } +} + + +template +void Foam::AMIInterpolation::reportSumWeights +( + const scalarField& patchAreas, + const word& patchName, + const scalarField& wghtSum, + const scalar lowWeightTol +) +{ + if (returnReduce(wghtSum.size(), sumOp