mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'AMI'
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I${LIB_SRC}/meshTools/lnInclude \
|
-I${LIB_SRC}/meshTools/lnInclude \
|
||||||
|
-I${LIB_SRC}/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
|
|||||||
@ -3,6 +3,8 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
|
-I$(LIB_SRC)/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels \
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
-I$(LIB_SRC)/finiteVolume/cfdTools \
|
||||||
|
|||||||
@ -16,4 +16,5 @@ EXE_LIBS = \
|
|||||||
-lincompressibleTransportModels \
|
-lincompressibleTransportModels \
|
||||||
-lincompressibleRASModels \
|
-lincompressibleRASModels \
|
||||||
-lincompressibleLESModels \
|
-lincompressibleLESModels \
|
||||||
-lfiniteVolume
|
-lfiniteVolume \
|
||||||
|
-lAMIInterpolation
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I${LIB_SRC}/meshTools/lnInclude \
|
-I${LIB_SRC}/meshTools/lnInclude \
|
||||||
|
-I${LIB_SRC}/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I${LIB_SRC}/meshTools/lnInclude \
|
-I${LIB_SRC}/meshTools/lnInclude \
|
||||||
|
-I${LIB_SRC}/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||||
|
|||||||
@ -11,6 +11,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
|
|||||||
@ -10,6 +10,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I${LIB_SRC}/meshTools/lnInclude \
|
-I${LIB_SRC}/meshTools/lnInclude \
|
||||||
|
-I${LIB_SRC}/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I${LIB_SRC}/meshTools/lnInclude \
|
-I${LIB_SRC}/meshTools/lnInclude \
|
||||||
|
-I${LIB_SRC}/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I${LIB_SRC}/meshTools/lnInclude \
|
-I${LIB_SRC}/meshTools/lnInclude \
|
||||||
|
-I${LIB_SRC}/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I${LIB_SRC}/meshTools/lnInclude \
|
-I${LIB_SRC}/meshTools/lnInclude \
|
||||||
|
-I${LIB_SRC}/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||||
|
|||||||
@ -8,6 +8,7 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|||||||
@ -15,7 +15,7 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
numberOfSubdomains 8;
|
numberOfSubdomains 2;
|
||||||
|
|
||||||
//- Keep owner and neighbour on same processor for faces in zones:
|
//- Keep owner and neighbour on same processor for faces in zones:
|
||||||
// preserveFaceZones (heater solid1 solid3);
|
// preserveFaceZones (heater solid1 solid3);
|
||||||
@ -24,13 +24,22 @@ numberOfSubdomains 8;
|
|||||||
// (makes sense only for cyclic patches)
|
// (makes sense only for cyclic patches)
|
||||||
//preservePatches (cyclic_half0 cyclic_half1);
|
//preservePatches (cyclic_half0 cyclic_half1);
|
||||||
|
|
||||||
|
//- Keep all of faceZone on a single processor. This puts all cells
|
||||||
|
// connected with a point, edge or face on the same processor.
|
||||||
|
// (just having face connected cells might not guarantee a balanced
|
||||||
|
// decomposition)
|
||||||
|
// The processor can be -1 (the decompositionMethod chooses the processor
|
||||||
|
// for a good load balance) or explicitly provided (upsets balance).
|
||||||
|
//singleProcessorFaceZones ((f0 -1));
|
||||||
|
|
||||||
|
|
||||||
//- Use the volScalarField named here as a weight for each cell in the
|
//- Use the volScalarField named here as a weight for each cell in the
|
||||||
// decomposition. For example, use a particle population field to decompose
|
// decomposition. For example, use a particle population field to decompose
|
||||||
// for a balanced number of particles in a lagrangian simulation.
|
// for a balanced number of particles in a lagrangian simulation.
|
||||||
// weightField dsmcRhoNMean;
|
// weightField dsmcRhoNMean;
|
||||||
|
|
||||||
method scotch;
|
method scotch;
|
||||||
// method hierarchical;
|
//method hierarchical;
|
||||||
// method simple;
|
// method simple;
|
||||||
// method metis;
|
// method metis;
|
||||||
// method manual;
|
// method manual;
|
||||||
@ -70,7 +79,7 @@ simpleCoeffs
|
|||||||
|
|
||||||
hierarchicalCoeffs
|
hierarchicalCoeffs
|
||||||
{
|
{
|
||||||
n (2 2 1);
|
n (1 2 1);
|
||||||
delta 0.001;
|
delta 0.001;
|
||||||
order xyz;
|
order xyz;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "cpuTime.H"
|
#include "cpuTime.H"
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "regionSplit.H"
|
#include "regionSplit.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -47,7 +48,8 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
{
|
{
|
||||||
wordList pNames(decompositionDict_.lookup("preservePatches"));
|
wordList pNames(decompositionDict_.lookup("preservePatches"));
|
||||||
|
|
||||||
Info<< "Keeping owner of faces in patches " << pNames
|
Info<< nl
|
||||||
|
<< "Keeping owner of faces in patches " << pNames
|
||||||
<< " on same processor. This only makes sense for cyclics." << endl;
|
<< " on same processor. This only makes sense for cyclics." << endl;
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = boundaryMesh();
|
const polyBoundaryMesh& patches = boundaryMesh();
|
||||||
@ -76,7 +78,8 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
{
|
{
|
||||||
wordList zNames(decompositionDict_.lookup("preserveFaceZones"));
|
wordList zNames(decompositionDict_.lookup("preserveFaceZones"));
|
||||||
|
|
||||||
Info<< "Keeping owner and neighbour of faces in zones " << zNames
|
Info<< nl
|
||||||
|
<< "Keeping owner and neighbour of faces in zones " << zNames
|
||||||
<< " on same processor" << endl;
|
<< " on same processor" << endl;
|
||||||
|
|
||||||
const faceZoneMesh& fZones = faceZones();
|
const faceZoneMesh& fZones = faceZones();
|
||||||
@ -103,6 +106,65 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Specified processor for owner and neighbour of faces
|
||||||
|
Map<label> specifiedProcessorFaces;
|
||||||
|
List<Tuple2<word, label> > zNameAndProcs;
|
||||||
|
|
||||||
|
if (decompositionDict_.found("singleProcessorFaceZones"))
|
||||||
|
{
|
||||||
|
decompositionDict_.lookup("singleProcessorFaceZones") >> zNameAndProcs;
|
||||||
|
|
||||||
|
const faceZoneMesh& fZones = faceZones();
|
||||||
|
|
||||||
|
label nCells = 0;
|
||||||
|
|
||||||
|
Info<< endl;
|
||||||
|
|
||||||
|
forAll(zNameAndProcs, i)
|
||||||
|
{
|
||||||
|
Info<< "Keeping all cells connected to faceZone "
|
||||||
|
<< zNameAndProcs[i].first()
|
||||||
|
<< " on processor " << zNameAndProcs[i].second() << endl;
|
||||||
|
|
||||||
|
label zoneI = fZones.findZoneID(zNameAndProcs[i].first());
|
||||||
|
|
||||||
|
if (zoneI == -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn("domainDecomposition::distributeCells()")
|
||||||
|
<< "Unknown singleProcessorFaceZone "
|
||||||
|
<< zNameAndProcs[i].first()
|
||||||
|
<< endl << "Valid faceZones are " << fZones.names()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceZone& fz = fZones[zoneI];
|
||||||
|
|
||||||
|
nCells += fz.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Size
|
||||||
|
specifiedProcessorFaces.resize(2*nCells);
|
||||||
|
|
||||||
|
|
||||||
|
// Fill
|
||||||
|
forAll(zNameAndProcs, i)
|
||||||
|
{
|
||||||
|
label zoneI = fZones.findZoneID(zNameAndProcs[i].first());
|
||||||
|
const faceZone& fz = fZones[zoneI];
|
||||||
|
|
||||||
|
label procI = zNameAndProcs[i].second();
|
||||||
|
|
||||||
|
forAll(fz, fzI)
|
||||||
|
{
|
||||||
|
label faceI = fz[fzI];
|
||||||
|
|
||||||
|
specifiedProcessorFaces.insert(faceI, procI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Construct decomposition method and either do decomposition on
|
// Construct decomposition method and either do decomposition on
|
||||||
// cell centres or on agglomeration
|
// cell centres or on agglomeration
|
||||||
|
|
||||||
@ -112,7 +174,8 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
decompositionDict_
|
decompositionDict_
|
||||||
);
|
);
|
||||||
|
|
||||||
if (sameProcFaces.empty())
|
|
||||||
|
if (sameProcFaces.empty() && specifiedProcessorFaces.empty())
|
||||||
{
|
{
|
||||||
if (decompositionDict_.found("weightField"))
|
if (decompositionDict_.found("weightField"))
|
||||||
{
|
{
|
||||||
@ -146,9 +209,11 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "Selected " << sameProcFaces.size()
|
Info<< "Constrained decomposition:" << endl
|
||||||
<< " faces whose owner and neighbour cell should be kept on the"
|
<< " faces with same processor owner and neighbour : "
|
||||||
<< " same processor" << endl;
|
<< sameProcFaces.size() << endl
|
||||||
|
<< " faces all on same processor : "
|
||||||
|
<< specifiedProcessorFaces.size() << endl << endl;
|
||||||
|
|
||||||
// Faces where owner and neighbour are not 'connected' (= all except
|
// Faces where owner and neighbour are not 'connected' (= all except
|
||||||
// sameProcFaces)
|
// sameProcFaces)
|
||||||
@ -159,6 +224,24 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
blockedFace[iter.key()] = false;
|
blockedFace[iter.key()] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// For specifiedProcessorFaces add all point connected faces
|
||||||
|
{
|
||||||
|
forAllConstIter(Map<label>, specifiedProcessorFaces, iter)
|
||||||
|
{
|
||||||
|
const face& f = faces()[iter.key()];
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
const labelList& pFaces = pointFaces()[f[fp]];
|
||||||
|
forAll(pFaces, i)
|
||||||
|
{
|
||||||
|
blockedFace[pFaces[i]] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Connect coupled boundary faces
|
// Connect coupled boundary faces
|
||||||
const polyBoundaryMesh& patches = boundaryMesh();
|
const polyBoundaryMesh& patches = boundaryMesh();
|
||||||
|
|
||||||
@ -201,10 +284,11 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
|
|
||||||
// Do decomposition on agglomeration
|
// Do decomposition on agglomeration
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
scalarField regionWeights(globalRegion.nRegions(), 0);
|
||||||
|
|
||||||
if (decompositionDict_.found("weightField"))
|
if (decompositionDict_.found("weightField"))
|
||||||
{
|
{
|
||||||
scalarField regionWeights(globalRegion.nRegions(), 0);
|
|
||||||
|
|
||||||
word weightName = decompositionDict_.lookup("weightField");
|
word weightName = decompositionDict_.lookup("weightField");
|
||||||
|
|
||||||
volScalarField weights
|
volScalarField weights
|
||||||
@ -226,23 +310,70 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
|
|
||||||
regionWeights[regionI] += weights.internalField()[cellI];
|
regionWeights[regionI] += weights.internalField()[cellI];
|
||||||
}
|
}
|
||||||
|
|
||||||
cellToProc_ = decomposePtr().decompose
|
|
||||||
(
|
|
||||||
*this,
|
|
||||||
globalRegion,
|
|
||||||
regionCentres,
|
|
||||||
regionWeights
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cellToProc_ = decomposePtr().decompose
|
forAll(globalRegion, cellI)
|
||||||
(
|
{
|
||||||
*this,
|
label regionI = globalRegion[cellI];
|
||||||
globalRegion,
|
|
||||||
regionCentres
|
regionWeights[regionI] += 1.0;
|
||||||
);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cellToProc_ = decomposePtr().decompose
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
globalRegion,
|
||||||
|
regionCentres,
|
||||||
|
regionWeights
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// For specifiedProcessorFaces rework the cellToProc to enforce
|
||||||
|
// all on one processor since we can't guarantee that the input
|
||||||
|
// to regionSplit was a single region.
|
||||||
|
// E.g. faceZone 'a' with the cells split into two regions
|
||||||
|
// by a notch formed by two walls
|
||||||
|
//
|
||||||
|
// \ /
|
||||||
|
// \ /
|
||||||
|
// ---a----+-----a-----
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Note that reworking the cellToProc might make the decomposition
|
||||||
|
// unbalanced.
|
||||||
|
if (specifiedProcessorFaces.size())
|
||||||
|
{
|
||||||
|
const faceZoneMesh& fZones = faceZones();
|
||||||
|
|
||||||
|
forAll(zNameAndProcs, i)
|
||||||
|
{
|
||||||
|
label zoneI = fZones.findZoneID(zNameAndProcs[i].first());
|
||||||
|
const faceZone& fz = fZones[zoneI];
|
||||||
|
|
||||||
|
if (fz.size())
|
||||||
|
{
|
||||||
|
label procI = zNameAndProcs[i].second();
|
||||||
|
if (procI == -1)
|
||||||
|
{
|
||||||
|
// If no processor specified use the one from the
|
||||||
|
// 0th element
|
||||||
|
procI = cellToProc_[faceOwner()[fz[0]]];
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(fz, fzI)
|
||||||
|
{
|
||||||
|
label faceI = fz[fzI];
|
||||||
|
|
||||||
|
cellToProc_[faceOwner()[faceI]] = procI;
|
||||||
|
if (isInternalFace(faceI))
|
||||||
|
{
|
||||||
|
cellToProc_[faceNeighbour()[faceI]] = procI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1557
src/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
Normal file
1557
src/AMIInterpolation/AMIInterpolation/AMIInterpolation.C
Normal file
File diff suppressed because it is too large
Load Diff
413
src/AMIInterpolation/AMIInterpolation/AMIInterpolation.H
Normal file
413
src/AMIInterpolation/AMIInterpolation/AMIInterpolation.H
Normal file
@ -0,0 +1,413 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::AMIInterpolation
|
||||||
|
|
||||||
|
Description
|
||||||
|
Interpolation class dealing with transfer of data between two
|
||||||
|
primitive patches with an arbitrary mesh interface (AMI).
|
||||||
|
|
||||||
|
Based on the algorithm given in:
|
||||||
|
|
||||||
|
Conservative interpolation between volume meshes by local Galerkin
|
||||||
|
projection, Farrell PE and Maddison JR, 2011, Comput. Methods Appl.
|
||||||
|
Mech Engrg, Volume 200, Issues 1-4, pp 89-100
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
AMIInterpolation.C
|
||||||
|
AMIInterpolationName.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef AMIInterpolation_H
|
||||||
|
#define AMIInterpolation_H
|
||||||
|
|
||||||
|
#include "className.H"
|
||||||
|
#include "DynamicList.H"
|
||||||
|
#include "searchableSurface.H"
|
||||||
|
#include "boolList.H"
|
||||||
|
#include "primitivePatch.H"
|
||||||
|
#include "faceAreaIntersect.H"
|
||||||
|
#include "treeBoundBox.H"
|
||||||
|
#include "treeBoundBoxList.H"
|
||||||
|
#include "globalIndex.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class AMIInterpolationName Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
TemplateName(AMIInterpolation);
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class AMIInterpolation Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
class AMIInterpolation
|
||||||
|
:
|
||||||
|
public AMIInterpolationName
|
||||||
|
{
|
||||||
|
|
||||||
|
//- Helper class for list
|
||||||
|
template<class T>
|
||||||
|
class ListPlusEqOp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void operator()(List<T>& x, const List<T> y) const
|
||||||
|
{
|
||||||
|
if (y.size())
|
||||||
|
{
|
||||||
|
if (x.size())
|
||||||
|
{
|
||||||
|
label sz = x.size();
|
||||||
|
x.setSize(sz + y.size());
|
||||||
|
forAll(y, i)
|
||||||
|
{
|
||||||
|
x[sz++] = y[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
// Source patch
|
||||||
|
|
||||||
|
//- Addresses of target faces per source face
|
||||||
|
labelListList srcAddress_;
|
||||||
|
|
||||||
|
//- Weights of target faces per source face
|
||||||
|
scalarListList srcWeights_;
|
||||||
|
|
||||||
|
|
||||||
|
// Target patch
|
||||||
|
|
||||||
|
//- Addresses of source faces per target face
|
||||||
|
labelListList tgtAddress_;
|
||||||
|
|
||||||
|
//- Weights of wource faces per target face
|
||||||
|
scalarListList tgtWeights_;
|
||||||
|
|
||||||
|
|
||||||
|
//- Starting face seed index
|
||||||
|
label startSeedI_;
|
||||||
|
|
||||||
|
//- Face triangulation mode
|
||||||
|
const faceAreaIntersect::triangulationMode triMode_;
|
||||||
|
|
||||||
|
//- Source map pointer - parallel running only
|
||||||
|
autoPtr<mapDistribute> srcMapPtr_;
|
||||||
|
|
||||||
|
//- Target map pointer - parallel running only
|
||||||
|
autoPtr<mapDistribute> tgtMapPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
AMIInterpolation(const AMIInterpolation&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const AMIInterpolation&);
|
||||||
|
|
||||||
|
|
||||||
|
// Helper functions
|
||||||
|
|
||||||
|
//- Write triangle intersection to OBJ file
|
||||||
|
void writeIntersectionOBJ
|
||||||
|
(
|
||||||
|
const scalar area,
|
||||||
|
const face& f1,
|
||||||
|
const face& f2,
|
||||||
|
const pointField& f1Points,
|
||||||
|
const pointField& f2Points
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Check that patches are valid
|
||||||
|
void checkPatches
|
||||||
|
(
|
||||||
|
const primitivePatch& srcPatch,
|
||||||
|
const primitivePatch& tgtPatch
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Parallel functionality
|
||||||
|
|
||||||
|
label calcOverlappingProcs
|
||||||
|
(
|
||||||
|
const List<treeBoundBoxList>& procBb,
|
||||||
|
const treeBoundBox& bb,
|
||||||
|
boolList& overlaps
|
||||||
|
);
|
||||||
|
|
||||||
|
void distributePatches
|
||||||
|
(
|
||||||
|
const mapDistribute& map,
|
||||||
|
const primitivePatch& pp,
|
||||||
|
const globalIndex& gi,
|
||||||
|
List<faceList>& faces,
|
||||||
|
List<pointField>& points,
|
||||||
|
List<labelList>& tgtFaceIDs
|
||||||
|
);
|
||||||
|
|
||||||
|
void distributeAndMergePatches
|
||||||
|
(
|
||||||
|
const mapDistribute& map,
|
||||||
|
const primitivePatch& tgtPatch,
|
||||||
|
const globalIndex& gi,
|
||||||
|
faceList& tgtFaces,
|
||||||
|
pointField& tgtPoints,
|
||||||
|
labelList& tgtFaceIDs
|
||||||
|
);
|
||||||
|
|
||||||
|
autoPtr<mapDistribute> calcProcMap
|
||||||
|
(
|
||||||
|
const primitivePatch& srcPatch,
|
||||||
|
const primitivePatch& tgtPatch
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Initialisation
|
||||||
|
|
||||||
|
//- Project points to surface
|
||||||
|
void projectPointsToSurface
|
||||||
|
(
|
||||||
|
const searchableSurface& surf,
|
||||||
|
pointField& pts
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Marching front
|
||||||
|
|
||||||
|
//- Find face on target patch that overlaps source face
|
||||||
|
label findTargetFace
|
||||||
|
(
|
||||||
|
const label srcFaceI,
|
||||||
|
const primitivePatch& srcPatch,
|
||||||
|
const primitivePatch& tgtPatch
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Add faces neighbouring faceI to the ID list
|
||||||
|
void appendNbrFaces
|
||||||
|
(
|
||||||
|
const label faceI,
|
||||||
|
const primitivePatch& patch,
|
||||||
|
const DynamicList<label>& visitedFaces,
|
||||||
|
DynamicList<label>& faceIDs
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Set the source and target seed faces
|
||||||
|
void setNextFaces
|
||||||
|
(
|
||||||
|
label& srcFaceI,
|
||||||
|
label& tgtFaceI,
|
||||||
|
const primitivePatch& srcPatch0,
|
||||||
|
const primitivePatch& tgtPatch0,
|
||||||
|
const boolList& mapFlag,
|
||||||
|
labelList& seedFaces,
|
||||||
|
const DynamicList<label>& visitedFaces
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Area of intersection between source and target faces
|
||||||
|
scalar interArea
|
||||||
|
(
|
||||||
|
const label srcFaceI,
|
||||||
|
const label tgtFaceI,
|
||||||
|
const primitivePatch& srcPatch,
|
||||||
|
const primitivePatch& tgtPatch
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Calculate addressing
|
||||||
|
void calcAddressing
|
||||||
|
(
|
||||||
|
const primitivePatch& srcPatch,
|
||||||
|
const primitivePatch& tgtPatch,
|
||||||
|
label srcFaceI = -1,
|
||||||
|
label tgtFaceI = -1
|
||||||
|
);
|
||||||
|
|
||||||
|
//- 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!
|
||||||
|
void normaliseWeights
|
||||||
|
(
|
||||||
|
const primitivePatch& patch,
|
||||||
|
const word& patchName,
|
||||||
|
const labelListList& addr,
|
||||||
|
scalarListList& wght,
|
||||||
|
const bool output
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
AMIInterpolation
|
||||||
|
(
|
||||||
|
const SourcePatch& srcPatch,
|
||||||
|
const TargetPatch& tgtPatch,
|
||||||
|
const faceAreaIntersect::triangulationMode& triMode
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components, with projection surface
|
||||||
|
AMIInterpolation
|
||||||
|
(
|
||||||
|
const SourcePatch& srcPatch,
|
||||||
|
const TargetPatch& tgtPatch,
|
||||||
|
const autoPtr<searchableSurface>& surf,
|
||||||
|
const faceAreaIntersect::triangulationMode& triMode
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
~AMIInterpolation();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
// Source patch
|
||||||
|
|
||||||
|
//- Return const access to source patch addressing
|
||||||
|
inline const labelListList& srcAddress();
|
||||||
|
|
||||||
|
//- Return const access to source patch weights
|
||||||
|
inline const scalarListList& srcWeights();
|
||||||
|
|
||||||
|
|
||||||
|
// Target patch
|
||||||
|
|
||||||
|
//- Return const access to target patch addressing
|
||||||
|
inline const labelListList& tgtAddress();
|
||||||
|
|
||||||
|
//- Return const access to target patch weights
|
||||||
|
inline const scalarListList& tgtWeights();
|
||||||
|
|
||||||
|
|
||||||
|
// Manipulation
|
||||||
|
|
||||||
|
//- Update addressing and weights
|
||||||
|
void update
|
||||||
|
(
|
||||||
|
const primitivePatch& srcPatch,
|
||||||
|
const primitivePatch& tgtPatch
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation
|
||||||
|
|
||||||
|
//- Interpolate from target to source
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > interpolateToSource(const Field<Type>& fld) const;
|
||||||
|
|
||||||
|
//- Interpolate from target tmp field to source
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > interpolateToSource
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Interpolate from source to target
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > interpolateToTarget(const Field<Type>& fld) const;
|
||||||
|
|
||||||
|
//- Interpolate from source tmp field to target
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > interpolateToTarget
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Checks
|
||||||
|
|
||||||
|
//- Write face connectivity as OBJ file
|
||||||
|
void writeFaceConnectivity
|
||||||
|
(
|
||||||
|
const primitivePatch& srcPatch,
|
||||||
|
const primitivePatch& tgtPatch,
|
||||||
|
const labelListList& srcAddress
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write weights to VTK file
|
||||||
|
void writeWeights
|
||||||
|
(
|
||||||
|
const scalarListList& weights,
|
||||||
|
const primitivePatch& patch,
|
||||||
|
const word& folder,
|
||||||
|
const word& prefix
|
||||||
|
)
|
||||||
|
const;
|
||||||
|
|
||||||
|
//- Write patch
|
||||||
|
void writePatch
|
||||||
|
(
|
||||||
|
const primitivePatch& patch,
|
||||||
|
const word& folder,
|
||||||
|
const word& prefix
|
||||||
|
)
|
||||||
|
const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "AMIInterpolationI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "AMIInterpolation.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
58
src/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H
Normal file
58
src/AMIInterpolation/AMIInterpolation/AMIInterpolationI.H
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
inline const Foam::labelListList&
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcAddress()
|
||||||
|
{
|
||||||
|
return srcAddress_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
inline const Foam::scalarListList&
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::srcWeights()
|
||||||
|
{
|
||||||
|
return srcWeights_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
inline const Foam::labelListList&
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtAddress()
|
||||||
|
{
|
||||||
|
return tgtAddress_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class SourcePatch, class TargetPatch>
|
||||||
|
inline const Foam::scalarListList&
|
||||||
|
Foam::AMIInterpolation<SourcePatch, TargetPatch>::tgtWeights()
|
||||||
|
{
|
||||||
|
return tgtWeights_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
32
src/AMIInterpolation/AMIInterpolation/AMIInterpolationName.C
Normal file
32
src/AMIInterpolation/AMIInterpolation/AMIInterpolationName.C
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(Foam::AMIInterpolationName, 0);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 AMIPatchToPatchInterpolation_H
|
||||||
|
#define AMIPatchToPatchInterpolation_H
|
||||||
|
|
||||||
|
#include "AMIInterpolation.H"
|
||||||
|
#include "PrimitivePatch.H"
|
||||||
|
#include "face.H"
|
||||||
|
#include "SubList.H"
|
||||||
|
#include "pointField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef AMIInterpolation
|
||||||
|
<
|
||||||
|
PrimitivePatch<face, SubList, const pointField&>,
|
||||||
|
PrimitivePatch<face, SubList, const pointField&>
|
||||||
|
> AMIPatchToPatchInterpolation;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
27
src/AMIInterpolation/Make/files
Normal file
27
src/AMIInterpolation/Make/files
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
AMIInterpolation/AMIInterpolationName.C
|
||||||
|
faceAreaIntersect/faceAreaIntersect.C
|
||||||
|
|
||||||
|
CYCPATCHES=patches/cyclic
|
||||||
|
$(CYCPATCHES)/cyclicAMILduInterfaceField/cyclicAMILduInterface.C
|
||||||
|
$(CYCPATCHES)/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C
|
||||||
|
$(CYCPATCHES)/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C
|
||||||
|
$(CYCPATCHES)/cyclicAMIFvPatch/cyclicAMIFvPatch.C
|
||||||
|
$(CYCPATCHES)/cyclicAMIFvPatchField/cyclicAMIFvPatchFields.C
|
||||||
|
$(CYCPATCHES)/cyclicAMIFvsPatchField/cyclicAMIFvsPatchFields.C
|
||||||
|
$(CYCPATCHES)/cyclicAMIPointPatch/cyclicAMIPointPatch.C
|
||||||
|
|
||||||
|
MAPPATCHES=patches/mapped
|
||||||
|
$(MAPPATCHES)/mappedPolyPatch/mappedPatchBase.C
|
||||||
|
$(MAPPATCHES)/mappedPolyPatch/mappedPolyPatch.C
|
||||||
|
$(MAPPATCHES)/mappedPolyPatch/mappedWallPolyPatch.C
|
||||||
|
$(MAPPATCHES)/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
|
||||||
|
$(MAPPATCHES)/mappedPolyPatch/mappedWallPointPatch.C
|
||||||
|
$(MAPPATCHES)/mappedFvPatch/mappedFvPatch.C
|
||||||
|
$(MAPPATCHES)/mappedFvPatch/mappedWallFvPatch.C
|
||||||
|
$(MAPPATCHES)/mappedFixedValue/mappedFixedValueFvPatchFields.C
|
||||||
|
$(MAPPATCHES)/mappedFixedInternalValue/mappedFixedInternalValueFvPatchFields.C
|
||||||
|
$(MAPPATCHES)/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchFields.C
|
||||||
|
|
||||||
|
$(MAPPATCHES)/mappedField/mappedFieldFvPatchFields.C
|
||||||
|
|
||||||
|
LIB = $(FOAM_LIBBIN)/libAMIInterpolation
|
||||||
11
src/AMIInterpolation/Make/options
Normal file
11
src/AMIInterpolation/Make/options
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-DFULLDEBUG -g -O0 \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
|
|
||||||
|
LIB_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-lmeshTools \
|
||||||
|
-lsampling
|
||||||
297
src/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C
Normal file
297
src/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.C
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "faceAreaIntersect.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::faceAreaIntersect::triSliceWithPlane
|
||||||
|
(
|
||||||
|
const triPoints& tri,
|
||||||
|
const plane& p,
|
||||||
|
FixedList<triPoints, 10>& tris,
|
||||||
|
label& nTris,
|
||||||
|
const scalar len
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const scalar matchTol = 1e-4;
|
||||||
|
|
||||||
|
// distance to cutting plane
|
||||||
|
FixedList<scalar, 3> d;
|
||||||
|
|
||||||
|
// determine how many of the points are above the cutting plane
|
||||||
|
label nCoPlanar = 0;
|
||||||
|
label nPos = 0;
|
||||||
|
label posI = -1;
|
||||||
|
label negI = -1;
|
||||||
|
forAll(tri, i)
|
||||||
|
{
|
||||||
|
d[i] = ((tri[i] - p.refPoint()) & p.normal());
|
||||||
|
|
||||||
|
if (mag(d[i]) < matchTol*len)
|
||||||
|
{
|
||||||
|
d[i] = 0.0;
|
||||||
|
nCoPlanar++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (d[i] > 0)
|
||||||
|
{
|
||||||
|
nPos++;
|
||||||
|
posI = i;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
negI = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((nPos == 3) || ((nPos == 2) && (nCoPlanar == 1)))
|
||||||
|
{
|
||||||
|
// all points above cutting plane - add triangle to list
|
||||||
|
tris[nTris++] = tri;
|
||||||
|
}
|
||||||
|
else if ((nPos == 2) || ((nPos == 1) && (nCoPlanar == 1)))
|
||||||
|
{
|
||||||
|
// 2 points above plane, 1 below
|
||||||
|
// resulting quad above plane split into 2 triangles
|
||||||
|
|
||||||
|
// point under the plane
|
||||||
|
label i0 = negI;
|
||||||
|
|
||||||
|
// indices of remaining points
|
||||||
|
label i1 = d.fcIndex(i0);
|
||||||
|
label i2 = d.fcIndex(i1);
|
||||||
|
|
||||||
|
// determine the two intersection points
|
||||||
|
point p01 = planeIntersection(d, tri, i0, i1);
|
||||||
|
point p02 = planeIntersection(d, tri, i0, i2);
|
||||||
|
|
||||||
|
// forget triangle below plane
|
||||||
|
// - decompose quad above plane into 2 triangles and add to list
|
||||||
|
setTriPoints(tri[i1], tri[i2], p02, nTris, tris);
|
||||||
|
setTriPoints(tri[i1], p02, p01, nTris, tris);
|
||||||
|
}
|
||||||
|
else if ((nPos == 1) && (nCoPlanar != 1))
|
||||||
|
{
|
||||||
|
// 1 point above plane, 2 below
|
||||||
|
// resulting quad below plane split into 2 triangles
|
||||||
|
|
||||||
|
// point above the plane
|
||||||
|
label i0 = posI;
|
||||||
|
|
||||||
|
// indices of remaining points
|
||||||
|
label i1 = d.fcIndex(i0);
|
||||||
|
label i2 = d.fcIndex(i1);
|
||||||
|
|
||||||
|
// determine the two intersection points
|
||||||
|
point p01 = planeIntersection(d, tri, i0, i1);
|
||||||
|
point p02 = planeIntersection(d, tri, i0, i2);
|
||||||
|
|
||||||
|
// forget quad below plane
|
||||||
|
// - add triangle above plane to list
|
||||||
|
setTriPoints(tri[i0], p01, p02, nTris, tris);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// all points below cutting plane - forget
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::scalar Foam::faceAreaIntersect::triangleIntersect
|
||||||
|
(
|
||||||
|
const triPoints& src,
|
||||||
|
const triPoints& tgt,
|
||||||
|
const vector& n
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Work storage
|
||||||
|
FixedList<triPoints, 10> workTris1;
|
||||||
|
label nWorkTris1 = 0;
|
||||||
|
|
||||||
|
FixedList<triPoints, 10> workTris2;
|
||||||
|
label nWorkTris2 = 0;
|
||||||
|
|
||||||
|
// cut source triangle with all inwards pointing faces of target triangle
|
||||||
|
// - triangles in workTris1 are inside target triangle
|
||||||
|
|
||||||
|
scalar t = sqrt(triArea(src));
|
||||||
|
|
||||||
|
// edge 0
|
||||||
|
{
|
||||||
|
// cut triangle src with plane and put resulting sub-triangles in
|
||||||
|
// workTris1 list
|
||||||
|
|
||||||
|
scalar s = mag(tgt[1] - tgt[0]);
|
||||||
|
plane pl0(tgt[0], tgt[1], tgt[1] + s*n);
|
||||||
|
triSliceWithPlane(src, pl0, workTris1, nWorkTris1, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nWorkTris1 == 0)
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// edge1
|
||||||
|
{
|
||||||
|
// cut workTris1 with plane and put resulting sub-triangles in
|
||||||
|
// workTris2 list (re-use tris storage)
|
||||||
|
|
||||||
|
scalar s = mag(tgt[2] - tgt[1]);
|
||||||
|
plane pl1(tgt[1], tgt[2], tgt[2] + s*n);
|
||||||
|
|
||||||
|
nWorkTris2 = 0;
|
||||||
|
|
||||||
|
for (label i = 0; i < nWorkTris1; i++)
|
||||||
|
{
|
||||||
|
triSliceWithPlane(workTris1[i], pl1, workTris2, nWorkTris2, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nWorkTris2 == 0)
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// edge2
|
||||||
|
{
|
||||||
|
// cut workTris2 with plane and put resulting sub-triangles in
|
||||||
|
// workTris1 list (re-use workTris1 storage)
|
||||||
|
|
||||||
|
scalar s = mag(tgt[2] - tgt[0]);
|
||||||
|
plane pl2(tgt[2], tgt[0], tgt[0] + s*n);
|
||||||
|
|
||||||
|
nWorkTris1 = 0;
|
||||||
|
|
||||||
|
for (label i = 0; i < nWorkTris2; i++)
|
||||||
|
{
|
||||||
|
triSliceWithPlane(workTris2[i], pl2, workTris1, nWorkTris1, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nWorkTris1 == 0)
|
||||||
|
{
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// calculate area of sub-triangles
|
||||||
|
scalar area = 0.0;
|
||||||
|
for (label i = 0; i < nWorkTris1; i++)
|
||||||
|
{
|
||||||
|
area += triArea(workTris1[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::faceAreaIntersect::faceAreaIntersect
|
||||||
|
(
|
||||||
|
const pointField& pointsA,
|
||||||
|
const pointField& pointsB
|
||||||
|
)
|
||||||
|
:
|
||||||
|
pointsA_(pointsA),
|
||||||
|
pointsB_(pointsB)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::faceAreaIntersect::calc
|
||||||
|
(
|
||||||
|
const face& faceA,
|
||||||
|
const face& faceB,
|
||||||
|
const vector& n,
|
||||||
|
const triangulationMode& triMode
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// split faces into triangles
|
||||||
|
DynamicList<face> trisA;
|
||||||
|
DynamicList<face> trisB;
|
||||||
|
|
||||||
|
switch (triMode)
|
||||||
|
{
|
||||||
|
case tmFan:
|
||||||
|
{
|
||||||
|
triangleFan(faceA, trisA);
|
||||||
|
triangleFan(faceB, trisB);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case tmMesh:
|
||||||
|
{
|
||||||
|
faceA.triangles(pointsA_, trisA);
|
||||||
|
faceB.triangles(pointsB_, trisB);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::scalar Foam::faceAreaIntersect::calc"
|
||||||
|
"("
|
||||||
|
"const face&, "
|
||||||
|
"const face&, "
|
||||||
|
"const vector&, "
|
||||||
|
"const triangulationMode&"
|
||||||
|
")"
|
||||||
|
) << "Unknown triangulation mode enumeration"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// intersect triangles
|
||||||
|
scalar totalArea = 0.0;
|
||||||
|
forAll(trisA, tA)
|
||||||
|
{
|
||||||
|
triPoints tpA = getTriPoints(pointsA_, trisA[tA], false);
|
||||||
|
|
||||||
|
// if (triArea(tpA) > ROOTVSMALL)
|
||||||
|
{
|
||||||
|
forAll(trisB, tB)
|
||||||
|
{
|
||||||
|
triPoints tpB = getTriPoints(pointsB_, trisB[tB], true);
|
||||||
|
|
||||||
|
// if (triArea(tpB) > ROOTVSMALL)
|
||||||
|
{
|
||||||
|
totalArea += triangleIntersect(tpA, tpB, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
174
src/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H
Normal file
174
src/AMIInterpolation/faceAreaIntersect/faceAreaIntersect.H
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::faceAreaIntersect
|
||||||
|
|
||||||
|
Description
|
||||||
|
Face intersection class
|
||||||
|
- calculates intersection area by sub-dividing face into triangles
|
||||||
|
and cutting
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
faceAreaIntersect.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef faceAreaIntersect_H
|
||||||
|
#define faceAreaIntersect_H
|
||||||
|
|
||||||
|
#include "pointField.H"
|
||||||
|
#include "FixedList.H"
|
||||||
|
#include "plane.H"
|
||||||
|
#include "face.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class faceAreaIntersect Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class faceAreaIntersect
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef FixedList<point, 3> triPoints;
|
||||||
|
|
||||||
|
enum triangulationMode
|
||||||
|
{
|
||||||
|
tmFan,
|
||||||
|
tmMesh
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference to the points of sideA
|
||||||
|
const pointField& pointsA_;
|
||||||
|
|
||||||
|
//- Reference to the points of sideB
|
||||||
|
const pointField& pointsB_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Get triPoints from face
|
||||||
|
inline triPoints getTriPoints
|
||||||
|
(
|
||||||
|
const pointField& points,
|
||||||
|
const face& f,
|
||||||
|
const bool reverse
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Set triPoints into tri list
|
||||||
|
inline void setTriPoints
|
||||||
|
(
|
||||||
|
const point& a,
|
||||||
|
const point& b,
|
||||||
|
const point& c,
|
||||||
|
label& count,
|
||||||
|
FixedList<triPoints, 10>& tris
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Decompose face into triangle fan
|
||||||
|
inline void triangleFan
|
||||||
|
(
|
||||||
|
const face& f,
|
||||||
|
DynamicList<face>& faces
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return point of intersection between plane and triangle edge
|
||||||
|
inline point planeIntersection
|
||||||
|
(
|
||||||
|
const FixedList<scalar, 3>& d,
|
||||||
|
const triPoints& t,
|
||||||
|
const label negI,
|
||||||
|
const label posI
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return triangle area
|
||||||
|
inline scalar triArea(const triPoints& t) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Slice triangle with plane and generate new cut sub-triangles
|
||||||
|
void triSliceWithPlane
|
||||||
|
(
|
||||||
|
const triPoints& tri,
|
||||||
|
const plane& p,
|
||||||
|
FixedList<triPoints, 10>& tris,
|
||||||
|
label& nTris,
|
||||||
|
const scalar len
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return area of intersection of triangles src and tgt
|
||||||
|
scalar triangleIntersect
|
||||||
|
(
|
||||||
|
const triPoints& src,
|
||||||
|
const triPoints& tgt,
|
||||||
|
const vector& n
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
faceAreaIntersect
|
||||||
|
(
|
||||||
|
const pointField& pointsA,
|
||||||
|
const pointField& pointsB
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Public Member Functions
|
||||||
|
|
||||||
|
//- Return area of intersection of faceA with faceB
|
||||||
|
scalar calc
|
||||||
|
(
|
||||||
|
const face& faceA,
|
||||||
|
const face& faceB,
|
||||||
|
const vector& n,
|
||||||
|
const triangulationMode& triMode
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "faceAreaIntersectI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
109
src/AMIInterpolation/faceAreaIntersect/faceAreaIntersectI.H
Normal file
109
src/AMIInterpolation/faceAreaIntersect/faceAreaIntersectI.H
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 void Foam::faceAreaIntersect::setTriPoints
|
||||||
|
(
|
||||||
|
const point& a,
|
||||||
|
const point& b,
|
||||||
|
const point& c,
|
||||||
|
label& count,
|
||||||
|
FixedList<triPoints, 10>& tris
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
triPoints& tp = tris[count++];
|
||||||
|
tp[0] = a;
|
||||||
|
tp[1] = b;
|
||||||
|
tp[2] = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::faceAreaIntersect::triPoints Foam::faceAreaIntersect::getTriPoints
|
||||||
|
(
|
||||||
|
const pointField& points,
|
||||||
|
const face& f,
|
||||||
|
const bool reverse
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
triPoints result;
|
||||||
|
|
||||||
|
if (reverse)
|
||||||
|
{
|
||||||
|
result[2] = points[f[0]];
|
||||||
|
result[1] = points[f[1]];
|
||||||
|
result[0] = points[f[2]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result[0] = points[f[0]];
|
||||||
|
result[1] = points[f[1]];
|
||||||
|
result[2] = points[f[2]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void Foam::faceAreaIntersect::triangleFan
|
||||||
|
(
|
||||||
|
const face& f,
|
||||||
|
DynamicList<face>& faces
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (f.size() > 2)
|
||||||
|
{
|
||||||
|
const label v0 = 0;
|
||||||
|
|
||||||
|
labelList indices(3);
|
||||||
|
|
||||||
|
for (label i = 1; i < f.size() - 1; i++)
|
||||||
|
{
|
||||||
|
indices[0] = f[v0];
|
||||||
|
indices[1] = f[i];
|
||||||
|
indices[2] = f[i + 1];
|
||||||
|
faces.append(face(indices));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::point Foam::faceAreaIntersect::planeIntersection
|
||||||
|
(
|
||||||
|
const FixedList<scalar, 3>& d,
|
||||||
|
const triPoints& t,
|
||||||
|
const label negI,
|
||||||
|
const label posI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return (d[posI]*t[negI] - d[negI]*t[posI])/(-d[negI] + d[posI]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::faceAreaIntersect::triArea(const triPoints& t) const
|
||||||
|
{
|
||||||
|
return mag(0.5*((t[1] - t[0])^(t[2] - t[0])));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMIFvPatch.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "transform.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(cyclicAMIFvPatch, 0);
|
||||||
|
addToRunTimeSelectionTable(fvPatch, cyclicAMIFvPatch, polyPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::cyclicAMIFvPatch::makeWeights(scalarField& w) const
|
||||||
|
{
|
||||||
|
const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
|
||||||
|
|
||||||
|
const scalarField deltas(nf() & fvPatch::delta());
|
||||||
|
|
||||||
|
const scalarField nbrDeltas
|
||||||
|
(
|
||||||
|
interpolate(nbrPatch.nf() & nbrPatch.fvPatch::delta())
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(deltas, faceI)
|
||||||
|
{
|
||||||
|
scalar di = deltas[faceI];
|
||||||
|
scalar dni = nbrDeltas[faceI];
|
||||||
|
|
||||||
|
w[faceI] = dni/(di + dni);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIFvPatch::makeDeltaCoeffs(scalarField& dc) const
|
||||||
|
{
|
||||||
|
const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
|
||||||
|
|
||||||
|
const scalarField deltas(nf() & fvPatch::delta());
|
||||||
|
|
||||||
|
const scalarField nbrDeltas
|
||||||
|
(
|
||||||
|
interpolate(nbrPatch.nf() & nbrPatch.fvPatch::delta())
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(deltas, faceI)
|
||||||
|
{
|
||||||
|
scalar di = deltas[faceI];
|
||||||
|
scalar dni = nbrDeltas[faceI];
|
||||||
|
|
||||||
|
dc[faceI] = 1.0/(di + dni);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::vectorField> Foam::cyclicAMIFvPatch::delta() const
|
||||||
|
{
|
||||||
|
const vectorField patchD(fvPatch::delta());
|
||||||
|
|
||||||
|
const cyclicAMIFvPatch& nbrPatch = neighbFvPatch();
|
||||||
|
const vectorField nbrPatchD(interpolate(nbrPatch.fvPatch::delta()));
|
||||||
|
|
||||||
|
tmp<vectorField> tpdv(new vectorField(patchD.size()));
|
||||||
|
vectorField& pdv = tpdv();
|
||||||
|
|
||||||
|
// do the transformation if necessary
|
||||||
|
if (parallel())
|
||||||
|
{
|
||||||
|
forAll(patchD, faceI)
|
||||||
|
{
|
||||||
|
vector ddi = patchD[faceI];
|
||||||
|
vector dni = nbrPatchD[faceI];
|
||||||
|
|
||||||
|
pdv[faceI] = ddi - dni;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(patchD, faceI)
|
||||||
|
{
|
||||||
|
vector ddi = patchD[faceI];
|
||||||
|
vector dni = nbrPatchD[faceI];
|
||||||
|
|
||||||
|
pdv[faceI] = ddi - transform(forwardT()[0], dni);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tpdv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::labelField> Foam::cyclicAMIFvPatch::interfaceInternalField
|
||||||
|
(
|
||||||
|
const labelUList& internalData
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return patchInternalField(internalData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::labelField> Foam::cyclicAMIFvPatch::internalFieldTransfer
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType,
|
||||||
|
const labelUList& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return neighbFvPatch().patchInternalField(iF);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,188 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cyclicAMIFvPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
Cyclic patch for Arbitrary Mesh Interface (AMI)
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cyclicAMIFvPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cyclicAMIFvPatch_H
|
||||||
|
#define cyclicAMIFvPatch_H
|
||||||
|
|
||||||
|
#include "coupledFvPatch.H"
|
||||||
|
#include "cyclicAMILduInterface.H"
|
||||||
|
#include "cyclicAMIPolyPatch.H"
|
||||||
|
#include "fvBoundaryMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cyclicAMIFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cyclicAMIFvPatch
|
||||||
|
:
|
||||||
|
public coupledFvPatch,
|
||||||
|
public cyclicAMILduInterface
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
const cyclicAMIPolyPatch& cyclicAMIPolyPatch_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member functions
|
||||||
|
|
||||||
|
//- Make patch weighting factors
|
||||||
|
void makeWeights(scalarField&) const;
|
||||||
|
|
||||||
|
//- Make patch face - neighbour cell distances
|
||||||
|
void makeDeltaCoeffs(scalarField&) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName(cyclicAMIPolyPatch::typeName_());
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from polyPatch
|
||||||
|
cyclicAMIFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
|
||||||
|
:
|
||||||
|
coupledFvPatch(patch, bm),
|
||||||
|
cyclicAMILduInterface(),
|
||||||
|
cyclicAMIPolyPatch_(refCast<const cyclicAMIPolyPatch>(patch))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return local reference cast into the cyclic patch
|
||||||
|
const cyclicAMIPolyPatch& cyclicAMIPatch() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPolyPatch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return neighbour
|
||||||
|
virtual label neighbPatchID() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPolyPatch_.nbrPatchID();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool owner() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPolyPatch_.owner();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return processor number
|
||||||
|
virtual const cyclicAMIFvPatch& neighbPatch() const
|
||||||
|
{
|
||||||
|
return refCast<const cyclicAMIFvPatch>
|
||||||
|
(
|
||||||
|
this->boundaryMesh()[cyclicAMIPolyPatch_.nbrPatchID()]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Are the cyclic planes parallel
|
||||||
|
virtual bool parallel() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPolyPatch_.parallel();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return face transformation tensor
|
||||||
|
virtual const tensorField& forwardT() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPolyPatch_.forwardT();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return neighbour-cell transformation tensor
|
||||||
|
virtual const tensorField& reverseT() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPolyPatch_.reverseT();
|
||||||
|
}
|
||||||
|
|
||||||
|
const cyclicAMIFvPatch& neighbFvPatch() const
|
||||||
|
{
|
||||||
|
return refCast<const cyclicAMIFvPatch>
|
||||||
|
(
|
||||||
|
this->boundaryMesh()[cyclicAMIPolyPatch_.nbrPatchID()]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return delta (P to N) vectors across coupled patch
|
||||||
|
virtual tmp<vectorField> delta() const;
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > interpolate(const Field<Type>& fld) const
|
||||||
|
{
|
||||||
|
return cyclicAMIPolyPatch_.interpolate(fld);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > interpolate(const tmp<Field<Type> >& tFld) const
|
||||||
|
{
|
||||||
|
return cyclicAMIPolyPatch_.interpolate(tFld);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Interface transfer functions
|
||||||
|
|
||||||
|
//- Return the values of the given internal data adjacent to
|
||||||
|
// the interface as a field
|
||||||
|
virtual tmp<labelField> interfaceInternalField
|
||||||
|
(
|
||||||
|
const labelUList& internalData
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return neighbour field
|
||||||
|
virtual tmp<labelField> internalFieldTransfer
|
||||||
|
(
|
||||||
|
const Pstream::commsTypes commsType,
|
||||||
|
const labelUList& internalData
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,217 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMIFvPatchField.H"
|
||||||
|
#include "transformField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cyclicAMILduInterfaceField(),
|
||||||
|
coupledFvPatchField<Type>(p, iF),
|
||||||
|
cyclicAMIPatch_(refCast<const cyclicAMIFvPatch>(p))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cyclicAMILduInterfaceField(),
|
||||||
|
coupledFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
cyclicAMIPatch_(refCast<const cyclicAMIFvPatch>(p))
|
||||||
|
{
|
||||||
|
if (!isA<cyclicAMIFvPatch>(this->patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField"
|
||||||
|
"("
|
||||||
|
"const cyclicAMIFvPatchField<Type>& ,"
|
||||||
|
"const fvPatch&, "
|
||||||
|
"const DimensionedField<Type, volMesh>&, "
|
||||||
|
"const fvPatchFieldMapper&"
|
||||||
|
")"
|
||||||
|
) << " patch type '" << p.type()
|
||||||
|
<< "' not constraint type '" << typeName << "'"
|
||||||
|
<< "\n for patch " << p.name()
|
||||||
|
<< " of field " << this->dimensionedInternalField().name()
|
||||||
|
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cyclicAMILduInterfaceField(),
|
||||||
|
coupledFvPatchField<Type>(p, iF, dict),
|
||||||
|
cyclicAMIPatch_(refCast<const cyclicAMIFvPatch>(p))
|
||||||
|
{
|
||||||
|
if (!isA<cyclicAMIFvPatch>(p))
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField"
|
||||||
|
"("
|
||||||
|
"const fvPatch&, "
|
||||||
|
"const Field<Type>&, "
|
||||||
|
"const dictionary&"
|
||||||
|
")",
|
||||||
|
dict
|
||||||
|
) << " patch type '" << p.type()
|
||||||
|
<< "' not constraint type '" << typeName << "'"
|
||||||
|
<< "\n for patch " << p.name()
|
||||||
|
<< " of field " << this->dimensionedInternalField().name()
|
||||||
|
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->evaluate(Pstream::blocking);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cyclicAMILduInterfaceField(),
|
||||||
|
coupledFvPatchField<Type>(ptf),
|
||||||
|
cyclicAMIPatch_(ptf.cyclicAMIPatch_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvPatchField<Type>::cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
cyclicAMILduInterfaceField(),
|
||||||
|
coupledFvPatchField<Type>(ptf, iF),
|
||||||
|
cyclicAMIPatch_(ptf.cyclicAMIPatch_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::cyclicAMIFvPatchField<Type>::patchNeighbourField() const
|
||||||
|
{
|
||||||
|
const Field<Type>& iField = this->internalField();
|
||||||
|
const labelUList& nbrFaceCells =
|
||||||
|
cyclicAMIPatch_.cyclicAMIPatch().nbrPatch().faceCells();
|
||||||
|
|
||||||
|
Field<Type> pnf(iField, nbrFaceCells);
|
||||||
|
|
||||||
|
tmp<Field<Type> > tpnf(new Field<Type>(cyclicAMIPatch_.interpolate(pnf)));
|
||||||
|
|
||||||
|
if (doTransform())
|
||||||
|
{
|
||||||
|
tpnf() = transform(forwardT(), tpnf());
|
||||||
|
}
|
||||||
|
|
||||||
|
return tpnf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::cyclicAMIFvPatchField<Type>&
|
||||||
|
Foam::cyclicAMIFvPatchField<Type>::neighbourPatchField() const
|
||||||
|
{
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& fld =
|
||||||
|
static_cast<const GeometricField<Type, fvPatchField, volMesh>&>
|
||||||
|
(
|
||||||
|
this->internalField()
|
||||||
|
);
|
||||||
|
|
||||||
|
return refCast<const cyclicAMIFvPatchField<Type> >
|
||||||
|
(
|
||||||
|
fld.boundaryField()[cyclicAMIPatch_.neighbPatchID()]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::cyclicAMIFvPatchField<Type>::updateInterfaceMatrix
|
||||||
|
(
|
||||||
|
const scalarField& psiInternal,
|
||||||
|
scalarField& result,
|
||||||
|
const lduMatrix&,
|
||||||
|
const scalarField& coeffs,
|
||||||
|
const direction cmpt,
|
||||||
|
const Pstream::commsTypes
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const labelUList& nbrFaceCells =
|
||||||
|
cyclicAMIPatch_.cyclicAMIPatch().nbrPatch().faceCells();
|
||||||
|
|
||||||
|
scalarField pnf(psiInternal, nbrFaceCells);
|
||||||
|
|
||||||
|
pnf = cyclicAMIPatch_.interpolate(pnf);
|
||||||
|
|
||||||
|
// Transform according to the transformation tensors
|
||||||
|
transformCoupleField(pnf, cmpt);
|
||||||
|
|
||||||
|
// Multiply the field by coefficients and add into the result
|
||||||
|
const labelUList& faceCells = cyclicAMIPatch_.faceCells();
|
||||||
|
|
||||||
|
forAll(faceCells, elemI)
|
||||||
|
{
|
||||||
|
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::cyclicAMIFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::write(os);
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,217 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cyclicAMIFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::cyclicAMIFvPatchField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cyclicAMIFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cyclicAMIFvPatchField_H
|
||||||
|
#define cyclicAMIFvPatchField_H
|
||||||
|
|
||||||
|
#include "coupledFvPatchField.H"
|
||||||
|
#include "cyclicAMILduInterfaceField.H"
|
||||||
|
#include "cyclicAMIFvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cyclicAMIFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class cyclicAMIFvPatchField
|
||||||
|
:
|
||||||
|
virtual public cyclicAMILduInterfaceField,
|
||||||
|
public coupledFvPatchField<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Local reference cast into the cyclic patch
|
||||||
|
const cyclicAMIFvPatch& cyclicAMIPatch_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Return neighbour side field given internal fields
|
||||||
|
template<class Type2>
|
||||||
|
tmp<Field<Type2> > neighbourSideField
|
||||||
|
(
|
||||||
|
const Field<Type2>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName(cyclicAMIFvPatch::typeName_());
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given cyclicAMIFvPatchField onto a new patch
|
||||||
|
cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
cyclicAMIFvPatchField(const cyclicAMIFvPatchField<Type>&);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new cyclicAMIFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
cyclicAMIFvPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- 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 cyclicAMIFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return local reference cast into the cyclic AMI patch
|
||||||
|
const cyclicAMIFvPatch& cyclicAMIPatch() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPatch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Return neighbour coupled internal cell data
|
||||||
|
tmp<Field<Type> > patchNeighbourField() const;
|
||||||
|
|
||||||
|
//- Return reference to neighbour patchField
|
||||||
|
const cyclicAMIFvPatchField<Type>& neighbourPatchField() const;
|
||||||
|
|
||||||
|
//- Update result field based on interface functionality
|
||||||
|
virtual void updateInterfaceMatrix
|
||||||
|
(
|
||||||
|
const scalarField& psiInternal,
|
||||||
|
scalarField& result,
|
||||||
|
const lduMatrix&,
|
||||||
|
const scalarField& coeffs,
|
||||||
|
const direction cmpt,
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Cyclic AMI coupled interface functions
|
||||||
|
|
||||||
|
//- Does the patch field perform the transformation
|
||||||
|
virtual bool doTransform() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
!(cyclicAMIPatch_.parallel() || pTraits<Type>::rank == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return face transformation tensor
|
||||||
|
virtual const tensorField& forwardT() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPatch_.forwardT();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return neighbour-cell transformation tensor
|
||||||
|
virtual const tensorField& reverseT() const
|
||||||
|
{
|
||||||
|
return cyclicAMIPatch_.reverseT();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return rank of component for transform
|
||||||
|
virtual int rank() const
|
||||||
|
{
|
||||||
|
return pTraits<Type>::rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// I-O
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "cyclicAMIFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMIFvPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(cyclicAMI);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 cyclicAMIFvPatchFields_H
|
||||||
|
#define cyclicAMIFvPatchFields_H
|
||||||
|
|
||||||
|
#include "cyclicAMIFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(cyclicAMI);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 cyclicAMIFvPatchFieldsFwd_H
|
||||||
|
#define cyclicAMIFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class cyclicAMIFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(cyclicAMI);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,126 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMIFvsPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, surfaceMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledFvsPatchField<Type>(p, iF),
|
||||||
|
cyclicAMIPatch_(refCast<const cyclicAMIFvPatch>(p))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvsPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, surfaceMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledFvsPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
cyclicAMIPatch_(refCast<const cyclicAMIFvPatch>(p))
|
||||||
|
{
|
||||||
|
if (!isA<cyclicAMIFvPatch>(this->patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField\n"
|
||||||
|
"("
|
||||||
|
"const cyclicAMIFvsPatchField<Type>&, "
|
||||||
|
"const fvPatch&, "
|
||||||
|
"const DimensionedField<Type, surfaceMesh>&, "
|
||||||
|
"const fvPatchFieldMapper&"
|
||||||
|
")"
|
||||||
|
) << "Field type does not correspond to patch type for patch "
|
||||||
|
<< this->patch().index() << "." << endl
|
||||||
|
<< "Field type: " << typeName << endl
|
||||||
|
<< "Patch type: " << this->patch().type()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, surfaceMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledFvsPatchField<Type>(p, iF, dict),
|
||||||
|
cyclicAMIPatch_(refCast<const cyclicAMIFvPatch>(p))
|
||||||
|
{
|
||||||
|
if (!isA<cyclicAMIFvPatch>(p))
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField"
|
||||||
|
"("
|
||||||
|
"const fvPatch&, "
|
||||||
|
"const Field<Type>&, "
|
||||||
|
"const dictionary&"
|
||||||
|
")",
|
||||||
|
dict
|
||||||
|
) << "patch " << this->patch().index() << " not cyclicAMI type. "
|
||||||
|
<< "Patch type = " << p.type()
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvsPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledFvsPatchField<Type>(ptf),
|
||||||
|
cyclicAMIPatch_(ptf.cyclicAMIPatch_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::cyclicAMIFvsPatchField<Type>::cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvsPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, surfaceMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledFvsPatchField<Type>(ptf, iF),
|
||||||
|
cyclicAMIPatch_(ptf.cyclicAMIPatch_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,143 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cyclicAMIFvsPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::cyclicAMIFvsPatchField
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cyclicAMIFvsPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cyclicAMIFvsPatchField_H
|
||||||
|
#define cyclicAMIFvsPatchField_H
|
||||||
|
|
||||||
|
#include "coupledFvsPatchField.H"
|
||||||
|
#include "cyclicAMIFvPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cyclicAMIFvsPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class cyclicAMIFvsPatchField
|
||||||
|
:
|
||||||
|
public coupledFvsPatchField<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Local reference cast into the cyclic patch
|
||||||
|
const cyclicAMIFvPatch& cyclicAMIPatch_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName(cyclicAMIFvPatch::typeName_());
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, surfaceMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, surfaceMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given cyclicAMIFvsPatchField onto a new patch
|
||||||
|
cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvsPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, surfaceMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvsPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvsPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvsPatchField<Type> >
|
||||||
|
(
|
||||||
|
new cyclicAMIFvsPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
cyclicAMIFvsPatchField
|
||||||
|
(
|
||||||
|
const cyclicAMIFvsPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, surfaceMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- 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 cyclicAMIFvsPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "cyclicAMIFvsPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMIFvsPatchFields.H"
|
||||||
|
#include "fvsPatchFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeFvsPatchFields(cyclicAMI);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 cyclicAMIFvsPatchFields_H
|
||||||
|
#define cyclicAMIFvsPatchFields_H
|
||||||
|
|
||||||
|
#include "cyclicAMIFvsPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeFvsPatchTypeFieldTypedefs(cyclicAMI);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 cyclicAMIFvsPatchFieldsFwd_H
|
||||||
|
#define cyclicAMIFvsPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class cyclicAMIFvsPatchField;
|
||||||
|
|
||||||
|
makeFvsPatchTypeFieldTypedefs(cyclicAMI);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMILduInterface.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(Foam::cyclicAMILduInterface, 0);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cyclicAMILduInterface::~cyclicAMILduInterface()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cyclicAMILduInterface
|
||||||
|
|
||||||
|
Description
|
||||||
|
An abstract base class for cyclic AMI coupled interfaces
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cyclicAMILduInterface.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cyclicAMILduInterface_H
|
||||||
|
#define cyclicAMILduInterface_H
|
||||||
|
|
||||||
|
#include "primitiveFieldsFwd.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cyclicAMILduInterface Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cyclicAMILduInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("cyclicAMILduInterface");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
cyclicAMILduInterface()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~cyclicAMILduInterface();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Return neighbour
|
||||||
|
virtual label neighbPatchID() const = 0;
|
||||||
|
|
||||||
|
virtual bool owner() const = 0;
|
||||||
|
|
||||||
|
//- Return processor number
|
||||||
|
virtual const cyclicAMILduInterface& neighbPatch() const = 0;
|
||||||
|
|
||||||
|
//- Return face transformation tensor
|
||||||
|
virtual const tensorField& forwardT() const = 0;
|
||||||
|
|
||||||
|
//- Return face reverse transformation tensor
|
||||||
|
virtual const tensorField& reverseT() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMILduInterfaceField.H"
|
||||||
|
#include "diagTensorField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(Foam::cyclicAMILduInterfaceField, 0);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cyclicAMILduInterfaceField::~cyclicAMILduInterfaceField()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::cyclicAMILduInterfaceField::transformCoupleField
|
||||||
|
(
|
||||||
|
scalarField& f,
|
||||||
|
const direction cmpt
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (doTransform())
|
||||||
|
{
|
||||||
|
if (forwardT().size() == 1)
|
||||||
|
{
|
||||||
|
f *= pow(diag(forwardT()[0]).component(cmpt), rank());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f *= pow(diag(forwardT())().component(cmpt), rank());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,103 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cyclicAMILduInterfaceField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Abstract base class for cyclic AMI coupled interfaces
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cyclicAMILduInterfaceField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cyclicAMILduInterfaceField_H
|
||||||
|
#define cyclicAMILduInterfaceField_H
|
||||||
|
|
||||||
|
#include "primitiveFieldsFwd.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cyclicAMILduInterfaceField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cyclicAMILduInterfaceField
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("cyclicAMILduInterfaceField");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
cyclicAMILduInterfaceField()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~cyclicAMILduInterfaceField();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Is the transform required
|
||||||
|
virtual bool doTransform() const = 0;
|
||||||
|
|
||||||
|
//- Return face transformation tensor
|
||||||
|
virtual const tensorField& forwardT() const = 0;
|
||||||
|
|
||||||
|
//- Return neighbour-cell transformation tensor
|
||||||
|
virtual const tensorField& reverseT() const = 0;
|
||||||
|
|
||||||
|
//- Return rank of component for transform
|
||||||
|
virtual int rank() const = 0;
|
||||||
|
|
||||||
|
|
||||||
|
//- Transform given patch internal field
|
||||||
|
void transformCoupleField
|
||||||
|
(
|
||||||
|
scalarField& psiInternal,
|
||||||
|
const direction cmpt
|
||||||
|
) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMIPointPatch.H"
|
||||||
|
#include "pointBoundaryMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(cyclicAMIPointPatch, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
facePointPatch,
|
||||||
|
cyclicAMIPointPatch,
|
||||||
|
polyPatch
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPointPatch::initGeometry(PstreamBuffers&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPointPatch::calcGeometry(PstreamBuffers&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPointPatch::initMovePoints
|
||||||
|
(
|
||||||
|
PstreamBuffers&,
|
||||||
|
const pointField&
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPointPatch::movePoints(PstreamBuffers&, const pointField&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPointPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
facePointPatch::initUpdateMesh(pBufs);
|
||||||
|
// cyclicAMIPointPatch::initGeometry(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPointPatch::updateMesh(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
facePointPatch::updateMesh(pBufs);
|
||||||
|
// cyclicAMIPointPatch::calcGeometry(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cyclicAMIPointPatch::cyclicAMIPointPatch
|
||||||
|
(
|
||||||
|
const polyPatch& patch,
|
||||||
|
const pointBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledFacePointPatch(patch, bm),
|
||||||
|
cyclicAMIPolyPatch_(refCast<const cyclicAMIPolyPatch>(patch))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cyclicAMIPointPatch::~cyclicAMIPointPatch()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,121 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cyclicAMIPointPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
Cyclic AMI point patch - place holder only
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cyclicAMIPointPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cyclicAMIPointPatch_H
|
||||||
|
#define cyclicAMIPointPatch_H
|
||||||
|
|
||||||
|
#include "coupledFacePointPatch.H"
|
||||||
|
#include "cyclicAMIPolyPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cyclicAMIPointPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cyclicAMIPointPatch
|
||||||
|
:
|
||||||
|
public coupledFacePointPatch
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Local reference cast into the cyclic AMI patch
|
||||||
|
const cyclicAMIPolyPatch& cyclicAMIPolyPatch_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default construct as copy
|
||||||
|
cyclicAMIPointPatch(const cyclicAMIPointPatch&);
|
||||||
|
|
||||||
|
//- Disallow default assignment
|
||||||
|
void operator=(const cyclicAMIPointPatch&);
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
TypeName(cyclicAMIPolyPatch::typeName_());
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
cyclicAMIPointPatch
|
||||||
|
(
|
||||||
|
const polyPatch& patch,
|
||||||
|
const pointBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~cyclicAMIPointPatch();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,799 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMIPolyPatch.H"
|
||||||
|
#include "transformField.H"
|
||||||
|
#include "SubField.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "faceAreaIntersect.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(cyclicAMIPolyPatch, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(polyPatch, cyclicAMIPolyPatch, word);
|
||||||
|
addToRunTimeSelectionTable(polyPatch, cyclicAMIPolyPatch, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::label Foam::cyclicAMIPolyPatch::findFaceMaxRadius
|
||||||
|
(
|
||||||
|
const pointField& faceCentres
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Determine a face furthest away from the axis
|
||||||
|
|
||||||
|
const scalarField magRadSqr
|
||||||
|
(
|
||||||
|
magSqr((faceCentres - rotationCentre_) ^ rotationAxis_)
|
||||||
|
);
|
||||||
|
|
||||||
|
label faceI = findMax(magRadSqr);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "findFaceMaxRadius(const pointField&)" << nl
|
||||||
|
<< " rotFace = " << faceI << nl
|
||||||
|
<< " point = " << faceCentres[faceI] << nl
|
||||||
|
<< " distance = " << Foam::sqrt(magRadSqr[faceI])
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return faceI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * Protecetd Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::calcTransforms()
|
||||||
|
{
|
||||||
|
if (size())
|
||||||
|
{
|
||||||
|
// Half0
|
||||||
|
const cyclicAMIPolyPatch& half0 = *this;
|
||||||
|
vectorField half0Areas(half0.size());
|
||||||
|
forAll(half0, facei)
|
||||||
|
{
|
||||||
|
half0Areas[facei] = half0[facei].normal(half0.points());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Half1
|
||||||
|
const cyclicAMIPolyPatch& half1 = nbrPatch();
|
||||||
|
vectorField half1Areas(half1.size());
|
||||||
|
forAll(half1, facei)
|
||||||
|
{
|
||||||
|
half1Areas[facei] = half1[facei].normal(half1.points());
|
||||||
|
}
|
||||||
|
|
||||||
|
calcTransforms
|
||||||
|
(
|
||||||
|
half0,
|
||||||
|
half0.faceCentres(),
|
||||||
|
half0Areas,
|
||||||
|
half1.faceCentres(),
|
||||||
|
half1Areas
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::calcTransforms
|
||||||
|
(
|
||||||
|
const primitivePatch& half0,
|
||||||
|
const pointField& half0Ctrs,
|
||||||
|
const vectorField& half0Areas,
|
||||||
|
const pointField& half1Ctrs,
|
||||||
|
const vectorField& half1Areas
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (transform_ != nbrPatch().transform_)
|
||||||
|
{
|
||||||
|
FatalErrorIn("cyclicAMIPolyPatch::calcTransforms()")
|
||||||
|
<< "Patch " << name()
|
||||||
|
<< " has transform type " << transformTypeNames[transform_]
|
||||||
|
<< ", neighbour patch " << nbrPatchName_
|
||||||
|
<< " has transform type "
|
||||||
|
<< nbrPatch().transformTypeNames[nbrPatch().transform_]
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Calculate transformation tensors
|
||||||
|
|
||||||
|
if ((half0Ctrs.size() <= 0) || (half1Ctrs.size() <= 0))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (transform_)
|
||||||
|
{
|
||||||
|
case ROTATIONAL:
|
||||||
|
{
|
||||||
|
label face0 = findFaceMaxRadius(half0Ctrs);
|
||||||
|
label face1 = findFaceMaxRadius(half1Ctrs);
|
||||||
|
|
||||||
|
vector n0 = ((half0Ctrs[face0] - rotationCentre_) ^ rotationAxis_);
|
||||||
|
vector n1 = ((half1Ctrs[face1] - rotationCentre_) ^ -rotationAxis_);
|
||||||
|
n0 /= mag(n0) + VSMALL;
|
||||||
|
n1 /= mag(n1) + VSMALL;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "cyclicAMIPolyPatch::calcTransforms :"
|
||||||
|
<< " Specified rotation :"
|
||||||
|
<< " n0:" << n0 << " n1:" << n1 << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extended tensor from two local coordinate systems calculated
|
||||||
|
// using normal and rotation axis
|
||||||
|
const tensor E0
|
||||||
|
(
|
||||||
|
rotationAxis_,
|
||||||
|
(n0 ^ rotationAxis_),
|
||||||
|
n0
|
||||||
|
);
|
||||||
|
const tensor E1
|
||||||
|
(
|
||||||
|
rotationAxis_,
|
||||||
|
(-n1 ^ rotationAxis_),
|
||||||
|
-n1
|
||||||
|
);
|
||||||
|
const tensor revT(E1.T() & E0);
|
||||||
|
const_cast<tensorField&>(forwardT()) = tensorField(1, revT.T());
|
||||||
|
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
|
||||||
|
const_cast<vectorField&>(separation()).setSize(0);
|
||||||
|
const_cast<boolList&>(collocated()) = boolList(1, false);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TRANSLATIONAL:
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "cyclicAMIPolyPatch::calcTransforms :"
|
||||||
|
<< "Specified translation : " << separationVector_
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const_cast<tensorField&>(forwardT()).clear();
|
||||||
|
const_cast<tensorField&>(reverseT()).clear();
|
||||||
|
const_cast<vectorField&>(separation()) = vectorField
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
separationVector_
|
||||||
|
);
|
||||||
|
const_cast<boolList&>(collocated()) = boolList(1, false);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "Assuming cyclic AMI pairs are colocated" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
const_cast<tensorField&>(forwardT()).clear();
|
||||||
|
const_cast<tensorField&>(reverseT()).clear();
|
||||||
|
const_cast<vectorField&>(separation()).setSize(0);
|
||||||
|
const_cast<boolList&>(collocated()) = boolList(1, true);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "patch: " << name() << nl
|
||||||
|
<< " forwardT = " << forwardT() << nl
|
||||||
|
<< " reverseT = " << reverseT() << nl
|
||||||
|
<< " separation = " << separation() << nl
|
||||||
|
<< " collocated = " << collocated() << nl << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::resetAMI()
|
||||||
|
{
|
||||||
|
if (owner())
|
||||||
|
{
|
||||||
|
AMIPtr_.clear();
|
||||||
|
|
||||||
|
const polyPatch& nbr = nbrPatch();
|
||||||
|
pointField nbrPoints = nbrPatch().localPoints();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
OFstream os(name() + "_neighbourPatch-org.obj");
|
||||||
|
meshTools::writeOBJ(os, nbrPatch().localFaces(), nbrPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
// transform neighbour patch to local system
|
||||||
|
transformPosition(nbrPoints);
|
||||||
|
primitivePatch nbrPatch0
|
||||||
|
(
|
||||||
|
SubList<face>
|
||||||
|
(
|
||||||
|
nbr.localFaces(),
|
||||||
|
nbr.size()
|
||||||
|
),
|
||||||
|
nbrPoints
|
||||||
|
);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
OFstream osN(name() + "_neighbourPatch-trans.obj");
|
||||||
|
meshTools::writeOBJ(osN, nbrPatch0.localFaces(), nbrPoints);
|
||||||
|
|
||||||
|
OFstream osO(name() + "_ownerPatch.obj");
|
||||||
|
meshTools::writeOBJ(osO, this->localFaces(), localPoints());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct/apply AMI interpolation to determine addressing and weights
|
||||||
|
AMIPtr_.reset
|
||||||
|
(
|
||||||
|
new AMIPatchToPatchInterpolation
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
nbrPatch0,
|
||||||
|
surfPtr(),
|
||||||
|
faceAreaIntersect::tmMesh
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
polyPatch::initGeometry(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
calcGeometry
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
faceCentres(),
|
||||||
|
faceAreas(),
|
||||||
|
faceCellCentres(),
|
||||||
|
nbrPatch().faceCentres(),
|
||||||
|
nbrPatch().faceAreas(),
|
||||||
|
nbrPatch().faceCellCentres()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::initMovePoints
|
||||||
|
(
|
||||||
|
PstreamBuffers& pBufs,
|
||||||
|
const pointField& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
polyPatch::initMovePoints(pBufs, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::movePoints
|
||||||
|
(
|
||||||
|
PstreamBuffers& pBufs,
|
||||||
|
const pointField& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
polyPatch::movePoints(pBufs, p);
|
||||||
|
|
||||||
|
calcTransforms();
|
||||||
|
|
||||||
|
resetAMI();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
polyPatch::initUpdateMesh(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::updateMesh(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
polyPatch::updateMesh(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledPolyPatch(name, size, start, index, bm),
|
||||||
|
nbrPatchName_(word::null),
|
||||||
|
nbrPatchID_(-1),
|
||||||
|
transform_(UNKNOWN),
|
||||||
|
rotationAxis_(vector::zero),
|
||||||
|
rotationCentre_(point::zero),
|
||||||
|
separationVector_(vector::zero),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dictionary::null)
|
||||||
|
{
|
||||||
|
// Neighbour patch might not be valid yet so no transformation
|
||||||
|
// calculation possible
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledPolyPatch(name, dict, index, bm),
|
||||||
|
nbrPatchName_(dict.lookup("neighbourPatch")),
|
||||||
|
nbrPatchID_(-1),
|
||||||
|
transform_(UNKNOWN),
|
||||||
|
rotationAxis_(vector::zero),
|
||||||
|
rotationCentre_(point::zero),
|
||||||
|
separationVector_(vector::zero),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dict.subOrEmptyDict("surface"))
|
||||||
|
{
|
||||||
|
if (nbrPatchName_ == name)
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"cyclicAMIPolyPatch::cyclicAMIPolyPatch"
|
||||||
|
"("
|
||||||
|
"const word&, "
|
||||||
|
"const dictionary&, "
|
||||||
|
"const label, "
|
||||||
|
"const polyBoundaryMesh&"
|
||||||
|
")",
|
||||||
|
dict
|
||||||
|
) << "Neighbour patch name " << nbrPatchName_
|
||||||
|
<< " cannot be the same as this patch " << name
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict.found("transform"))
|
||||||
|
{
|
||||||
|
transform_ = transformTypeNames.read(dict.lookup("transform"));
|
||||||
|
switch (transform_)
|
||||||
|
{
|
||||||
|
case ROTATIONAL:
|
||||||
|
{
|
||||||
|
dict.lookup("rotationAxis") >> rotationAxis_;
|
||||||
|
dict.lookup("rotationCentre") >> rotationCentre_;
|
||||||
|
|
||||||
|
scalar magRot = mag(rotationAxis_);
|
||||||
|
if (magRot < SMALL)
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"cyclicAMIPolyPatch::cyclicAMIPolyPatch"
|
||||||
|
"("
|
||||||
|
"const word&, "
|
||||||
|
"const dictionary&, "
|
||||||
|
"const label, "
|
||||||
|
"const polyBoundaryMesh&"
|
||||||
|
")",
|
||||||
|
dict
|
||||||
|
) << "Illegal rotationAxis " << rotationAxis_ << endl
|
||||||
|
<< "Please supply a non-zero vector."
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
rotationAxis_ /= magRot;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TRANSLATIONAL:
|
||||||
|
{
|
||||||
|
dict.lookup("separationVector") >> separationVector_;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// no additional info required
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Neighbour patch might not be valid yet so no transformation
|
||||||
|
// calculation possible
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const cyclicAMIPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledPolyPatch(pp, bm),
|
||||||
|
nbrPatchName_(pp.nbrPatchName_),
|
||||||
|
nbrPatchID_(-1),
|
||||||
|
transform_(UNKNOWN),
|
||||||
|
rotationAxis_(vector::zero),
|
||||||
|
rotationCentre_(point::zero),
|
||||||
|
separationVector_(vector::zero),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dictionary::null)
|
||||||
|
{
|
||||||
|
// Neighbour patch might not be valid yet so no transformation
|
||||||
|
// calculation possible
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const cyclicAMIPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const label newSize,
|
||||||
|
const label newStart,
|
||||||
|
const word& nbrPatchName
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledPolyPatch(pp, bm, index, newSize, newStart),
|
||||||
|
nbrPatchName_(nbrPatchName),
|
||||||
|
nbrPatchID_(-1),
|
||||||
|
transform_(UNKNOWN),
|
||||||
|
rotationAxis_(vector::zero),
|
||||||
|
rotationCentre_(point::zero),
|
||||||
|
separationVector_(vector::zero),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dictionary::null)
|
||||||
|
{
|
||||||
|
if (nbrPatchName_ == name())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"const cyclicAMIPolyPatch& "
|
||||||
|
"const polyBoundaryMesh&, "
|
||||||
|
"const label, "
|
||||||
|
"const label, "
|
||||||
|
"const label, "
|
||||||
|
"const word&"
|
||||||
|
) << "Neighbour patch name " << nbrPatchName_
|
||||||
|
<< " cannot be the same as this patch " << name()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Neighbour patch might not be valid yet so no transformation
|
||||||
|
// calculation possible
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const cyclicAMIPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const labelUList& mapAddressing,
|
||||||
|
const label newStart
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledPolyPatch(pp, bm, index, mapAddressing, newStart),
|
||||||
|
nbrPatchName_(pp.nbrPatchName_),
|
||||||
|
nbrPatchID_(-1),
|
||||||
|
transform_(pp.transform_),
|
||||||
|
rotationAxis_(pp.rotationAxis_),
|
||||||
|
rotationCentre_(pp.rotationCentre_),
|
||||||
|
separationVector_(pp.separationVector_),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(pp.surfDict_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::cyclicAMIPolyPatch::~cyclicAMIPolyPatch()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::label Foam::cyclicAMIPolyPatch::nbrPatchID() const
|
||||||
|
{
|
||||||
|
if (nbrPatchID_ == -1)
|
||||||
|
{
|
||||||
|
nbrPatchID_ = this->boundaryMesh().findPatchID(nbrPatchName_);
|
||||||
|
|
||||||
|
if (nbrPatchID_ == -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn("cyclicPolyAMIPatch::nbrPatchID() const")
|
||||||
|
<< "Illegal neighbourPatch name " << nbrPatchName_
|
||||||
|
<< nl << "Valid patch names are "
|
||||||
|
<< this->boundaryMesh().names()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that it is a cyclic AMI patch
|
||||||
|
const cyclicAMIPolyPatch& nbrPatch =
|
||||||
|
refCast<const cyclicAMIPolyPatch>
|
||||||
|
(
|
||||||
|
this->boundaryMesh()[nbrPatchID_]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (nbrPatch.nbrPatchName() != name())
|
||||||
|
{
|
||||||
|
WarningIn("cyclicAMIPolyPatch::nbrPatchID() const")
|
||||||
|
<< "Patch " << name()
|
||||||
|
<< " specifies neighbour patch " << nbrPatchName()
|
||||||
|
<< nl << " but that in return specifies "
|
||||||
|
<< nbrPatch.nbrPatchName() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nbrPatchID_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::cyclicAMIPolyPatch::owner() const
|
||||||
|
{
|
||||||
|
return index() < nbrPatchID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::autoPtr<Foam::searchableSurface>&
|
||||||
|
Foam::cyclicAMIPolyPatch::surfPtr()
|
||||||
|
{
|
||||||
|
const word surfType(surfDict_.lookupOrDefault<word>("type", "none"));
|
||||||
|
|
||||||
|
if (!surfPtr_.valid() && owner() && surfType != "none")
|
||||||
|
{
|
||||||
|
word surfName(surfDict_.lookupOrDefault("name", name()));
|
||||||
|
|
||||||
|
const polyMesh& mesh = boundaryMesh().mesh();
|
||||||
|
|
||||||
|
surfPtr_ =
|
||||||
|
searchableSurface::New
|
||||||
|
(
|
||||||
|
surfType,
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
surfName,
|
||||||
|
mesh.time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surfDict_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return surfPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::AMIPatchToPatchInterpolation& Foam::cyclicAMIPolyPatch::AMI()
|
||||||
|
{
|
||||||
|
if (!owner())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"const AMIPatchToPatchInterpolation& cyclicAMIPolyPatch::AMI()"
|
||||||
|
)
|
||||||
|
<< "AMI interpolator only available to owner patch"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!AMIPtr_.valid())
|
||||||
|
{
|
||||||
|
resetAMI();
|
||||||
|
}
|
||||||
|
|
||||||
|
return AMIPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const
|
||||||
|
{
|
||||||
|
if (!parallel())
|
||||||
|
{
|
||||||
|
if (transform_ == ROTATIONAL)
|
||||||
|
{
|
||||||
|
l = Foam::transform(forwardT(), l - rotationCentre_)
|
||||||
|
+ rotationCentre_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
l = Foam::transform(forwardT(), l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (separated())
|
||||||
|
{
|
||||||
|
// transformPosition gets called on the receiving side,
|
||||||
|
// separation gets calculated on the sending side so subtract
|
||||||
|
|
||||||
|
const vectorField& s = separation();
|
||||||
|
if (s.size() == 1)
|
||||||
|
{
|
||||||
|
forAll(l, i)
|
||||||
|
{
|
||||||
|
l[i] -= s[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
l -= s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::transformPosition
|
||||||
|
(
|
||||||
|
point& l,
|
||||||
|
const label faceI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (!parallel())
|
||||||
|
{
|
||||||
|
const tensor& T =
|
||||||
|
(
|
||||||
|
forwardT().size() == 1
|
||||||
|
? forwardT()[0]
|
||||||
|
: forwardT()[faceI]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (transform_ == ROTATIONAL)
|
||||||
|
{
|
||||||
|
l = Foam::transform(T, l - rotationCentre_) + rotationCentre_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
l = Foam::transform(T, l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (separated())
|
||||||
|
{
|
||||||
|
const vector& s =
|
||||||
|
(
|
||||||
|
separation().size() == 1
|
||||||
|
? separation()[0]
|
||||||
|
: separation()[faceI]
|
||||||
|
);
|
||||||
|
|
||||||
|
l -= s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::calcGeometry
|
||||||
|
(
|
||||||
|
const primitivePatch& referPatch,
|
||||||
|
const pointField& thisCtrs,
|
||||||
|
const vectorField& thisAreas,
|
||||||
|
const pointField& thisCc,
|
||||||
|
const pointField& nbrCtrs,
|
||||||
|
const vectorField& nbrAreas,
|
||||||
|
const pointField& nbrCc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
calcTransforms
|
||||||
|
(
|
||||||
|
referPatch,
|
||||||
|
thisCtrs,
|
||||||
|
thisAreas,
|
||||||
|
nbrCtrs,
|
||||||
|
nbrAreas
|
||||||
|
);
|
||||||
|
|
||||||
|
resetAMI();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::initOrder
|
||||||
|
(
|
||||||
|
PstreamBuffers& pBufs,
|
||||||
|
const primitivePatch& pp
|
||||||
|
) const
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::cyclicAMIPolyPatch::order
|
||||||
|
(
|
||||||
|
PstreamBuffers& pBufs,
|
||||||
|
const primitivePatch& pp,
|
||||||
|
labelList& faceMap,
|
||||||
|
labelList& rotation
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
faceMap.setSize(pp.size());
|
||||||
|
faceMap = -1;
|
||||||
|
|
||||||
|
rotation.setSize(pp.size());
|
||||||
|
rotation = 0;
|
||||||
|
|
||||||
|
// do nothing
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::cyclicAMIPolyPatch::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
coupledPolyPatch::write(os);
|
||||||
|
os.writeKeyword("neighbourPatch") << nbrPatchName_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
switch (transform_)
|
||||||
|
{
|
||||||
|
case ROTATIONAL:
|
||||||
|
{
|
||||||
|
os.writeKeyword("transform") << transformTypeNames[transform_]
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("rotationAxis") << rotationAxis_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("rotationCentre") << rotationCentre_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TRANSLATIONAL:
|
||||||
|
{
|
||||||
|
os.writeKeyword("transform") << transformTypeNames[transform_]
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("separationVector") << separationVector_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NOORDERING:
|
||||||
|
{
|
||||||
|
os.writeKeyword("transform") << transformTypeNames[transform_]
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// no additional info to write
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
os.writeKeyword(surfDict_.dictName());
|
||||||
|
os << surfDict_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,371 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cyclicAMIPolyPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
Cyclic patch for Arbitrary Mesh Interface (AMI)
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cyclicAMIPolyPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cyclicAMIPolyPatch_H
|
||||||
|
#define cyclicAMIPolyPatch_H
|
||||||
|
|
||||||
|
#include "coupledPolyPatch.H"
|
||||||
|
#include "AMIPatchToPatchInterpolation.H"
|
||||||
|
#include "polyBoundaryMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cyclicAMIPolyPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cyclicAMIPolyPatch
|
||||||
|
:
|
||||||
|
public coupledPolyPatch
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of other half
|
||||||
|
const word nbrPatchName_;
|
||||||
|
|
||||||
|
//- Index of other half
|
||||||
|
mutable label nbrPatchID_;
|
||||||
|
|
||||||
|
|
||||||
|
// Transformations
|
||||||
|
|
||||||
|
//- Type of transformation - rotational or translational
|
||||||
|
transformType transform_;
|
||||||
|
|
||||||
|
|
||||||
|
// For rotation
|
||||||
|
|
||||||
|
//- Axis of rotation for rotational cyclics
|
||||||
|
vector rotationAxis_;
|
||||||
|
|
||||||
|
//- point on axis of rotation for rotational cyclics
|
||||||
|
point rotationCentre_;
|
||||||
|
|
||||||
|
|
||||||
|
// For translation
|
||||||
|
|
||||||
|
//- Translation vector
|
||||||
|
vector separationVector_;
|
||||||
|
|
||||||
|
|
||||||
|
//- AMI interpolation class
|
||||||
|
autoPtr<AMIPatchToPatchInterpolation> AMIPtr_;
|
||||||
|
|
||||||
|
//- Projection surface
|
||||||
|
autoPtr<searchableSurface> surfPtr_;
|
||||||
|
|
||||||
|
//- Dictionary used during projection surface construction
|
||||||
|
const dictionary surfDict_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Return face ID of face at max distance from rotation axis
|
||||||
|
label findFaceMaxRadius(const pointField& faceCentres) const;
|
||||||
|
|
||||||
|
void calcTransforms
|
||||||
|
(
|
||||||
|
const primitivePatch& half0,
|
||||||
|
const pointField& half0Ctrs,
|
||||||
|
const vectorField& half0Areas,
|
||||||
|
const pointField& half1Ctrs,
|
||||||
|
const vectorField& half1Areas
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Reset the AMI interpolator
|
||||||
|
void resetAMI();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Recalculate the transformation tensors
|
||||||
|
virtual void calcTransforms();
|
||||||
|
|
||||||
|
//- Initialise the calculation of the patch geometry
|
||||||
|
virtual void initGeometry(PstreamBuffers&);
|
||||||
|
|
||||||
|
//- Calculate the patch geometry
|
||||||
|
virtual void calcGeometry(PstreamBuffers&);
|
||||||
|
|
||||||
|
//- Initialise the patches for moving points
|
||||||
|
virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
|
||||||
|
|
||||||
|
//- Correct patches after moving points
|
||||||
|
virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
|
||||||
|
|
||||||
|
//- Initialise the update of the patch topology
|
||||||
|
virtual void initUpdateMesh(PstreamBuffers&);
|
||||||
|
|
||||||
|
//- Update of the patch topology
|
||||||
|
virtual void updateMesh(PstreamBuffers&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("cyclicAMI");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from (base couped patch) components
|
||||||
|
cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy, resetting the boundary mesh
|
||||||
|
cyclicAMIPolyPatch(const cyclicAMIPolyPatch&, const polyBoundaryMesh&);
|
||||||
|
|
||||||
|
//- Construct given the original patch and resetting the
|
||||||
|
// face list and boundary mesh information
|
||||||
|
cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const cyclicAMIPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const label newSize,
|
||||||
|
const label newStart,
|
||||||
|
const word& nbrPatchName
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given the original patch and a map
|
||||||
|
cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
const cyclicAMIPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const labelUList& mapAddressing,
|
||||||
|
const label newStart
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Construct and return a clone, resetting the boundary mesh
|
||||||
|
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
|
||||||
|
{
|
||||||
|
return autoPtr<polyPatch>(new cyclicAMIPolyPatch(*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 cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
*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 cyclicAMIPolyPatch
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
bm,
|
||||||
|
index,
|
||||||
|
mapAddressing,
|
||||||
|
newStart
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~cyclicAMIPolyPatch();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
//- Neighbour patch name
|
||||||
|
inline const word& nbrPatchName() const;
|
||||||
|
|
||||||
|
//- Neighbour patch ID
|
||||||
|
virtual label nbrPatchID() const;
|
||||||
|
|
||||||
|
//- Does this side own the patch?
|
||||||
|
virtual bool owner() const;
|
||||||
|
|
||||||
|
//- Return a reference to the neihgjbour patch
|
||||||
|
inline const cyclicAMIPolyPatch& nbrPatch() const;
|
||||||
|
|
||||||
|
//- Return a reference to the projection surface
|
||||||
|
const autoPtr<searchableSurface>& surfPtr();
|
||||||
|
|
||||||
|
//- Return a reference to the AMI interpolator
|
||||||
|
const AMIPatchToPatchInterpolation& AMI();
|
||||||
|
|
||||||
|
|
||||||
|
// Transformations
|
||||||
|
|
||||||
|
//- Type of transform
|
||||||
|
inline transformType transform() const;
|
||||||
|
|
||||||
|
//- Axis of rotation for rotational cyclic AMI
|
||||||
|
inline const vector& rotationAxis() const;
|
||||||
|
|
||||||
|
//- point on axis of rotation for rotational cyclic AMI
|
||||||
|
inline const point& rotationCentre() const;
|
||||||
|
|
||||||
|
//- Translation vector for translational cyclic AMI
|
||||||
|
inline const vector& separationVector() const;
|
||||||
|
|
||||||
|
//- Transform patch-based positions from nbr side to this side
|
||||||
|
virtual void transformPosition(pointField&) const;
|
||||||
|
|
||||||
|
//- Transform a patch-based position from nbr side to this side
|
||||||
|
virtual void transformPosition
|
||||||
|
(
|
||||||
|
point& l,
|
||||||
|
const label faceI
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
// Interpolations
|
||||||
|
|
||||||
|
//- Interpolate field
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > interpolate(const Field<Type>& fld) const;
|
||||||
|
|
||||||
|
//- Interpolate tmp field
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > interpolate
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Calculate the patch geometry
|
||||||
|
virtual void calcGeometry
|
||||||
|
(
|
||||||
|
const primitivePatch& referPatch,
|
||||||
|
const pointField& thisCtrs,
|
||||||
|
const vectorField& thisAreas,
|
||||||
|
const pointField& thisCc,
|
||||||
|
const pointField& nbrCtrs,
|
||||||
|
const vectorField& nbrAreas,
|
||||||
|
const pointField& nbrCc
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Initialize ordering for primitivePatch. Does not
|
||||||
|
// refer to *this (except for name() and type() etc.)
|
||||||
|
virtual void initOrder
|
||||||
|
(
|
||||||
|
PstreamBuffers&,
|
||||||
|
const primitivePatch&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return new ordering for primitivePatch.
|
||||||
|
// Ordering is -faceMap: for every face
|
||||||
|
// index of the new face -rotation:for every new face the clockwise
|
||||||
|
// shift of the original face. Return false if nothing changes
|
||||||
|
// (faceMap is identity, rotation is 0), true otherwise.
|
||||||
|
virtual bool order
|
||||||
|
(
|
||||||
|
PstreamBuffers&,
|
||||||
|
const primitivePatch&,
|
||||||
|
labelList& faceMap,
|
||||||
|
labelList& rotation
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Write the polyPatch data as a dictionary
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "cyclicAMIPolyPatchI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "cyclicAMIPolyPatchTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::cyclicAMIPolyPatch::nbrPatchName() const
|
||||||
|
{
|
||||||
|
return nbrPatchName_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::cyclicAMIPolyPatch&
|
||||||
|
Foam::cyclicAMIPolyPatch::nbrPatch() const
|
||||||
|
{
|
||||||
|
const polyPatch& pp = this->boundaryMesh()[nbrPatchID()];
|
||||||
|
return refCast<const cyclicAMIPolyPatch>(pp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::coupledPolyPatch::transformType
|
||||||
|
Foam::cyclicAMIPolyPatch::transform() const
|
||||||
|
{
|
||||||
|
return transform_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::vector& Foam::cyclicAMIPolyPatch::rotationAxis() const
|
||||||
|
{
|
||||||
|
return rotationAxis_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::point& Foam::cyclicAMIPolyPatch::rotationCentre() const
|
||||||
|
{
|
||||||
|
return rotationCentre_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::vector& Foam::cyclicAMIPolyPatch::separationVector() const
|
||||||
|
{
|
||||||
|
return separationVector_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "cyclicAMIPolyPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> > Foam::cyclicAMIPolyPatch::interpolate
|
||||||
|
(
|
||||||
|
const Field<Type>& fld
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (owner())
|
||||||
|
{
|
||||||
|
return AMIPtr_->interpolateToSource(fld);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nbrPatch().AMIPtr_->interpolateToTarget(fld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> > Foam::cyclicAMIPolyPatch::interpolate
|
||||||
|
(
|
||||||
|
const tmp<Field<Type> >& tFld
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (owner())
|
||||||
|
{
|
||||||
|
return AMIPtr_->interpolateToSource(tFld);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nbrPatch().AMIPtr_->interpolateToTarget(tFld);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,348 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFieldFvPatchField.H"
|
||||||
|
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "interpolationCell.H"
|
||||||
|
#include "mapDistribute.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedPatchBase(p.patch()),
|
||||||
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
|
fieldName_(iF.name()),
|
||||||
|
setAverage_(false),
|
||||||
|
average_(pTraits<Type>::zero)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFieldFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedPatchBase(p.patch(), ptf),
|
||||||
|
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedPatchBase(p.patch(), dict),
|
||||||
|
fixedValueFvPatchField<Type>(p, iF, dict),
|
||||||
|
fieldName_(dict.template lookupOrDefault<word>("fieldName", iF.name())),
|
||||||
|
setAverage_(readBool(dict.lookup("setAverage"))),
|
||||||
|
average_(pTraits<Type>(dict.lookup("average")))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
|
||||||
|
// mappedPatchBase
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode sampleMode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const scalar distance,
|
||||||
|
|
||||||
|
// My settings
|
||||||
|
const word& fieldName,
|
||||||
|
const bool setAverage,
|
||||||
|
const Type average
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
p.patch(),
|
||||||
|
sampleRegion,
|
||||||
|
sampleMode,
|
||||||
|
samplePatch,
|
||||||
|
distance
|
||||||
|
),
|
||||||
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
|
fieldName_(fieldName),
|
||||||
|
setAverage_(setAverage),
|
||||||
|
average_(average)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFieldFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedPatchBase(ptf.patch().patch(), ptf),
|
||||||
|
fixedValueFvPatchField<Type>(ptf),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFieldFvPatchField<Type>::mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFieldFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedPatchBase(ptf.patch().patch(), ptf),
|
||||||
|
fixedValueFvPatchField<Type>(ptf, iF),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
mappedFieldFvPatchField<Type>::sampleField() const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
|
||||||
|
|
||||||
|
if (sameRegion())
|
||||||
|
{
|
||||||
|
if (fieldName_ == this->dimensionedInternalField().name())
|
||||||
|
{
|
||||||
|
// Optimisation: bypass field lookup
|
||||||
|
return
|
||||||
|
dynamic_cast<const fieldType&>
|
||||||
|
(
|
||||||
|
this->dimensionedInternalField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
|
||||||
|
return thisMesh.template lookupObject<fieldType>(fieldName_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nbrMesh.template lookupObject<fieldType>(fieldName_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void mappedFieldFvPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
// Since we're inside initEvaluate/evaluate there might be processor
|
||||||
|
// comms underway. Change the tag we use.
|
||||||
|
int oldTag = UPstream::msgType();
|
||||||
|
UPstream::msgType() = oldTag + 1;
|
||||||
|
|
||||||
|
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
|
||||||
|
|
||||||
|
// Result of obtaining remote values
|
||||||
|
Field<Type> newValues;
|
||||||
|
|
||||||
|
switch (mode())
|
||||||
|
{
|
||||||
|
case NEARESTCELL:
|
||||||
|
{
|
||||||
|
const mapDistribute& distMap = mappedPatchBase::map();
|
||||||
|
newValues = sampleField();
|
||||||
|
|
||||||
|
distMap.distribute(newValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NEARESTPATCHFACE:
|
||||||
|
{
|
||||||
|
const label nbrPatchID =
|
||||||
|
nbrMesh.boundaryMesh().findPatchID(samplePatch());
|
||||||
|
if (nbrPatchID < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void mappedFieldFvPatchField<Type>::updateCoeffs()"
|
||||||
|
)<< "Unable to find sample patch " << samplePatch()
|
||||||
|
<< " in region " << sampleRegion()
|
||||||
|
<< " for patch " << this->patch().name() << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldType& nbrField = sampleField();
|
||||||
|
|
||||||
|
const mapDistribute& distMap = mappedPatchBase::map();
|
||||||
|
newValues = nbrField.boundaryField()[nbrPatchID];
|
||||||
|
distMap.distribute(newValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappedPatchBase::NEARESTPATCHFACEAMI:
|
||||||
|
{
|
||||||
|
const label nbrPatchID =
|
||||||
|
nbrMesh.boundaryMesh().findPatchID(samplePatch());
|
||||||
|
|
||||||
|
if (nbrPatchID < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
|
||||||
|
)<< "Unable to find sample patch " << samplePatch()
|
||||||
|
<< " in region " << sampleRegion()
|
||||||
|
<< " for patch " << this->patch().name() << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// const fieldType& nbrField = sampleField();
|
||||||
|
// newValues = mpp.AMI().interpolateToSource(nbrField);
|
||||||
|
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
"void mappedFieldFvPatchField<Type>::updateCoeffs() "
|
||||||
|
"with mappedPatchBase::NEARESTPATCHFACEAMI"
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NEARESTFACE:
|
||||||
|
{
|
||||||
|
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
|
||||||
|
|
||||||
|
const fieldType& nbrField = sampleField();
|
||||||
|
|
||||||
|
forAll(nbrField.boundaryField(), patchI)
|
||||||
|
{
|
||||||
|
const fvPatchField<Type>& pf =
|
||||||
|
nbrField.boundaryField()[patchI];
|
||||||
|
label faceStart = pf.patch().patch().start();
|
||||||
|
|
||||||
|
forAll(pf, faceI)
|
||||||
|
{
|
||||||
|
allValues[faceStart++] = pf[faceI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapDistribute& distMap = mappedPatchBase::map();
|
||||||
|
distMap.distribute(allValues);
|
||||||
|
|
||||||
|
newValues.transfer(allValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedFieldFvPatchField<Type>::updateCoeffs()")
|
||||||
|
<< "Unknown sampling mode: " << mode()
|
||||||
|
<< nl << abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setAverage_)
|
||||||
|
{
|
||||||
|
Type averagePsi =
|
||||||
|
gSum(this->patch().magSf()*newValues)
|
||||||
|
/gSum(this->patch().magSf());
|
||||||
|
|
||||||
|
if (mag(averagePsi)/mag(average_) > 0.5)
|
||||||
|
{
|
||||||
|
newValues *= mag(average_)/mag(averagePsi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newValues += (average_ - averagePsi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->operator==(newValues);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "operating on field:" << this->dimensionedInternalField().name()
|
||||||
|
<< " patch:" << this->patch().name()
|
||||||
|
<< " avg:" << gAverage(*this)
|
||||||
|
<< " min:" << gMin(*this)
|
||||||
|
<< " max:" << gMax(*this)
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore tag
|
||||||
|
UPstream::msgType() = oldTag;
|
||||||
|
|
||||||
|
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void mappedFieldFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::write(os);
|
||||||
|
mappedPatchBase::write(os);
|
||||||
|
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,201 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedFieldFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Self-contained version of mapped. Does not use information on
|
||||||
|
patch, instead holds it locally (and possibly duplicate) so use
|
||||||
|
normal mapped in preference and only use this if you cannot
|
||||||
|
change the underlying patch type to mapped.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedFieldFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedFieldFvPatchField_H
|
||||||
|
#define mappedFieldFvPatchField_H
|
||||||
|
|
||||||
|
#include "mappedPatchBase.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedFieldFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class mappedFieldFvPatchField
|
||||||
|
:
|
||||||
|
public mappedPatchBase,
|
||||||
|
public fixedValueFvPatchField<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of field to sample - defaults to field associated with this
|
||||||
|
// patchField if not specified
|
||||||
|
word fieldName_;
|
||||||
|
|
||||||
|
//- If true adjust the mapped field to maintain average value average_
|
||||||
|
const bool setAverage_;
|
||||||
|
|
||||||
|
//- Average value the mapped field is adjusted to maintain if
|
||||||
|
// setAverage_ is set true
|
||||||
|
const Type average_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Field to sample. Either on my or nbr mesh
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("mappedField");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and distance for normal type
|
||||||
|
// sampling
|
||||||
|
mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
|
||||||
|
// mappedPatchBase
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode sampleMode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const scalar distance,
|
||||||
|
|
||||||
|
// My settings
|
||||||
|
const word& fieldName,
|
||||||
|
const bool setAverage,
|
||||||
|
const Type average
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// mappedFieldFvPatchField
|
||||||
|
// onto a new patch
|
||||||
|
mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFieldFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFieldFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new mappedFieldFvPatchField<Type>
|
||||||
|
(
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
mappedFieldFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFieldFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- 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 mappedFieldFvPatchField<Type>
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "mappedFieldFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFieldFvPatchFields.H"
|
||||||
|
#include "volMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(mappedField);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 mappedFieldFvPatchFields_H
|
||||||
|
#define mappedFieldFvPatchFields_H
|
||||||
|
|
||||||
|
#include "mappedFieldFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(mappedField)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 mappedFieldFvPatchFieldsFwd_H
|
||||||
|
#define mappedFieldFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class mappedFieldFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(mappedField)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,175 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFixedInternalValueFvPatchField.H"
|
||||||
|
#include "UIndirectList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedInternalValueFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedInternalValueFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(ptf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedInternalValueFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(ptf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::mappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
||||||
|
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since we're inside initEvaluate/evaluate there might be processor
|
||||||
|
// comms underway. Change the tag we use.
|
||||||
|
int oldTag = UPstream::msgType();
|
||||||
|
UPstream::msgType() = oldTag + 1;
|
||||||
|
|
||||||
|
// Retrieve the neighbour values and assign to this patch boundary field
|
||||||
|
mappedFixedValueFvPatchField<Type>::updateCoeffs();
|
||||||
|
|
||||||
|
// Get the coupling information from the mappedPatchBase
|
||||||
|
const mappedPatchBase& mpp =
|
||||||
|
refCast<const mappedPatchBase>(this->patch().patch());
|
||||||
|
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
|
||||||
|
const label samplePatchI = mpp.samplePolyPatch().index();
|
||||||
|
const fvPatch& nbrPatch = nbrMesh.boundary()[samplePatchI];
|
||||||
|
|
||||||
|
|
||||||
|
// Retrieve the neighbour field
|
||||||
|
const fvPatchField<Type>& nbrField =
|
||||||
|
nbrPatch.template lookupPatchField<FieldType, Type>
|
||||||
|
(
|
||||||
|
this->dimensionedInternalField().name()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Retrieve the neighbour patch internal field
|
||||||
|
Field<Type> nbrIntFld(nbrField.patchInternalField());
|
||||||
|
|
||||||
|
switch (mpp.mode())
|
||||||
|
{
|
||||||
|
case (mappedPatchBase::NEARESTPATCHFACEAMI):
|
||||||
|
{
|
||||||
|
// Retrieve the neighbour patch internal field
|
||||||
|
nbrIntFld = mpp.AMI().interpolateToSource(nbrIntFld);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
const mapDistribute& distMap = mpp.map();
|
||||||
|
|
||||||
|
mapDistribute::distribute
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType,
|
||||||
|
distMap.schedule(),
|
||||||
|
distMap.constructSize(),
|
||||||
|
distMap.subMap(), // what to send
|
||||||
|
distMap.constructMap(), // what to receive
|
||||||
|
nbrIntFld
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore tag
|
||||||
|
UPstream::msgType() = oldTag;
|
||||||
|
|
||||||
|
// Assign to (this) patch internal field its neighbour values
|
||||||
|
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
|
||||||
|
UIndirectList<Type>(intFld, this->patch().faceCells()) = nbrIntFld;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::mappedFixedInternalValueFvPatchField<Type>::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
mappedFixedValueFvPatchField<Type>::write(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedFixedInternalValueFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Recycles the boundary and internal values of a neighbour patch field to
|
||||||
|
the boundary and internal values of *this.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedFixedInternalValueFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedFixedInternalValueFvPatchField_H
|
||||||
|
#define mappedFixedInternalValueFvPatchField_H
|
||||||
|
|
||||||
|
#include "mappedFixedValueFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedFixedInternalValueFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class mappedFixedInternalValueFvPatchField
|
||||||
|
:
|
||||||
|
public mappedFixedValueFvPatchField<Type>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("mappedFixedInternalValue");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given
|
||||||
|
// mappedFixedInternalValueFvPatchField onto a new patch
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedInternalValueFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedInternalValueFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new mappedFixedInternalValueFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
mappedFixedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedInternalValueFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- 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 mappedFixedInternalValueFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "mappedFixedInternalValueFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFixedInternalValueFvPatchFields.H"
|
||||||
|
#include "volMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(mappedFixedInternalValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 mappedFixedInternalValueFvPatchFields_H
|
||||||
|
#define mappedFixedInternalValueFvPatchFields_H
|
||||||
|
|
||||||
|
#include "mappedFixedInternalValueFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(mappedFixedInternalValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 mappedFixedInternalValueFvPatchFieldsFwd_H
|
||||||
|
#define mappedFixedInternalValueFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class mappedFixedInternalValueFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(mappedFixedInternalValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFixedPushedInternalValueFvPatchField.H"
|
||||||
|
#include "UIndirectList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedPushedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(p, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedPushedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedPushedInternalValueFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(ptf, p, iF, mapper)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedPushedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(p, iF, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedPushedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedPushedInternalValueFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(ptf)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::mappedFixedPushedInternalValueFvPatchField<Type>::
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedPushedInternalValueFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedFixedValueFvPatchField<Type>(ptf, iF)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::mappedFixedPushedInternalValueFvPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
||||||
|
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve the neighbour values and assign to this patch boundary field
|
||||||
|
mappedFixedValueFvPatchField<Type>::updateCoeffs();
|
||||||
|
|
||||||
|
// Assign the patch internal field to its boundary value
|
||||||
|
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
|
||||||
|
UIndirectList<Type>(intFld, this->patch().faceCells()) = *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::mappedFixedPushedInternalValueFvPatchField<Type>::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
mappedFixedValueFvPatchField<Type>::write(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,157 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedFixedPushedInternalValueFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Recycles the boundary values of a neighbour patch field to the boundary
|
||||||
|
and internal values of *this.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedFixedPushedInternalValueFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedFixedPushedInternalValueFvPatchField_H
|
||||||
|
#define mappedFixedPushedInternalValueFvPatchField_H
|
||||||
|
|
||||||
|
#include "mappedFixedValueFvPatchField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedFixedPushedInternalValueFvPatchField Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class mappedFixedPushedInternalValueFvPatchField
|
||||||
|
:
|
||||||
|
public mappedFixedValueFvPatchField<Type>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("mappedFixedPushedInternalValue");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given a
|
||||||
|
// mappedFixedPushedInternalValueFvPatchField onto a new patch
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedPushedInternalValueFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedPushedInternalValueFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new mappedFixedPushedInternalValueFvPatchField<Type>
|
||||||
|
(
|
||||||
|
*this
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
mappedFixedPushedInternalValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedPushedInternalValueFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- 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 mappedFixedPushedInternalValueFvPatchField<Type>
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
iF
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "mappedFixedPushedInternalValueFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFixedPushedInternalValueFvPatchFields.H"
|
||||||
|
#include "volMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(mappedFixedPushedInternalValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 mappedFixedPushedInternalValueFvPatchFields_H
|
||||||
|
#define mappedFixedPushedInternalValueFvPatchFields_H
|
||||||
|
|
||||||
|
#include "mappedFixedPushedInternalValueFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(mappedFixedPushedInternalValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 mappedFixedPushedInternalValueFvPatchFieldsFwd_H
|
||||||
|
#define mappedFixedPushedInternalValueFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class mappedFixedPushedInternalValueFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(mappedFixedInternalValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,421 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFixedValueFvPatchField.H"
|
||||||
|
#include "mappedPatchBase.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "interpolationCell.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
|
fieldName_(iF.name()),
|
||||||
|
setAverage_(false),
|
||||||
|
average_(pTraits<Type>::zero),
|
||||||
|
interpolationScheme_(interpolationCell<Type>::typeName)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedValueFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_),
|
||||||
|
interpolationScheme_(ptf.interpolationScheme_)
|
||||||
|
{
|
||||||
|
if (!isA<mappedPatchBase>(this->patch().patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"mappedFixedValueFvPatchField<Type>::"
|
||||||
|
"mappedFixedValueFvPatchField\n"
|
||||||
|
"(\n"
|
||||||
|
" const mappedFixedValueFvPatchField<Type>&,\n"
|
||||||
|
" const fvPatch&,\n"
|
||||||
|
" const Field<Type>&,\n"
|
||||||
|
" const fvPatchFieldMapper&\n"
|
||||||
|
")\n"
|
||||||
|
) << "\n patch type '" << p.type()
|
||||||
|
<< "' not type '" << mappedPatchBase::typeName << "'"
|
||||||
|
<< "\n for patch " << p.name()
|
||||||
|
<< " of field " << this->dimensionedInternalField().name()
|
||||||
|
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(p, iF, dict),
|
||||||
|
fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())),
|
||||||
|
setAverage_(readBool(dict.lookup("setAverage"))),
|
||||||
|
average_(pTraits<Type>(dict.lookup("average"))),
|
||||||
|
interpolationScheme_(interpolationCell<Type>::typeName)
|
||||||
|
{
|
||||||
|
if (!isA<mappedPatchBase>(this->patch().patch()))
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"mappedFixedValueFvPatchField<Type>::"
|
||||||
|
"mappedFixedValueFvPatchField\n"
|
||||||
|
"(\n"
|
||||||
|
" const fvPatch& p,\n"
|
||||||
|
" const DimensionedField<Type, volMesh>& iF,\n"
|
||||||
|
" const dictionary& dict\n"
|
||||||
|
")\n"
|
||||||
|
) << "\n patch type '" << p.type()
|
||||||
|
<< "' not type '" << mappedPatchBase::typeName << "'"
|
||||||
|
<< "\n for patch " << p.name()
|
||||||
|
<< " of field " << this->dimensionedInternalField().name()
|
||||||
|
<< " in file " << this->dimensionedInternalField().objectPath()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
|
||||||
|
(
|
||||||
|
mappedFixedValueFvPatchField<Type>::patch().patch()
|
||||||
|
);
|
||||||
|
if (mpp.mode() == mappedPatchBase::NEARESTCELL)
|
||||||
|
{
|
||||||
|
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedValueFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_),
|
||||||
|
interpolationScheme_(ptf.interpolationScheme_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
mappedFixedValueFvPatchField<Type>::mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedValueFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
fixedValueFvPatchField<Type>(ptf, iF),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_),
|
||||||
|
interpolationScheme_(ptf.interpolationScheme_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
mappedFixedValueFvPatchField<Type>::sampleField() const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
|
||||||
|
(
|
||||||
|
mappedFixedValueFvPatchField<Type>::patch().patch()
|
||||||
|
);
|
||||||
|
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
|
||||||
|
|
||||||
|
if (mpp.sameRegion())
|
||||||
|
{
|
||||||
|
if (fieldName_ == this->dimensionedInternalField().name())
|
||||||
|
{
|
||||||
|
// Optimisation: bypass field lookup
|
||||||
|
return
|
||||||
|
dynamic_cast<const fieldType&>
|
||||||
|
(
|
||||||
|
this->dimensionedInternalField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
|
||||||
|
return thisMesh.lookupObject<fieldType>(fieldName_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nbrMesh.lookupObject<fieldType>(fieldName_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const interpolation<Type>&
|
||||||
|
mappedFixedValueFvPatchField<Type>::interpolator() const
|
||||||
|
{
|
||||||
|
if (!interpolator_.valid())
|
||||||
|
{
|
||||||
|
interpolator_ = interpolation<Type>::New
|
||||||
|
(
|
||||||
|
interpolationScheme_,
|
||||||
|
sampleField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return interpolator_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void mappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
// Since we're inside initEvaluate/evaluate there might be processor
|
||||||
|
// comms underway. Change the tag we use.
|
||||||
|
int oldTag = UPstream::msgType();
|
||||||
|
UPstream::msgType() = oldTag + 1;
|
||||||
|
|
||||||
|
// Get the scheduling information from the mappedPatchBase
|
||||||
|
const mappedPatchBase& mpp = refCast<const mappedPatchBase>
|
||||||
|
(
|
||||||
|
mappedFixedValueFvPatchField<Type>::patch().patch()
|
||||||
|
);
|
||||||
|
|
||||||
|
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
|
||||||
|
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
|
||||||
|
|
||||||
|
// Result of obtaining remote values
|
||||||
|
Field<Type> newValues;
|
||||||
|
|
||||||
|
switch (mpp.mode())
|
||||||
|
{
|
||||||
|
case mappedPatchBase::NEARESTCELL:
|
||||||
|
{
|
||||||
|
const mapDistribute& distMap = mpp.map();
|
||||||
|
|
||||||
|
if (interpolationScheme_ != interpolationCell<Type>::typeName)
|
||||||
|
{
|
||||||
|
// Send back sample points to the processor that holds the cell
|
||||||
|
vectorField samples(mpp.samplePoints());
|
||||||
|
distMap.reverseDistribute
|
||||||
|
(
|
||||||
|
(mpp.sameRegion() ? thisMesh.nCells() : nbrMesh.nCells()),
|
||||||
|
point::max,
|
||||||
|
samples
|
||||||
|
);
|
||||||
|
|
||||||
|
const interpolation<Type>& interp = interpolator();
|
||||||
|
|
||||||
|
newValues.setSize(samples.size(), pTraits<Type>::max);
|
||||||
|
forAll(samples, cellI)
|
||||||
|
{
|
||||||
|
if (samples[cellI] != point::max)
|
||||||
|
{
|
||||||
|
newValues[cellI] = interp.interpolate
|
||||||
|
(
|
||||||
|
samples[cellI],
|
||||||
|
cellI
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newValues = sampleField();
|
||||||
|
}
|
||||||
|
|
||||||
|
distMap.distribute(newValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappedPatchBase::NEARESTPATCHFACE:
|
||||||
|
{
|
||||||
|
const mapDistribute& distMap = mpp.map();
|
||||||
|
|
||||||
|
const label nbrPatchID =
|
||||||
|
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
|
||||||
|
|
||||||
|
if (nbrPatchID < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
|
||||||
|
)<< "Unable to find sample patch " << mpp.samplePatch()
|
||||||
|
<< " in region " << mpp.sampleRegion()
|
||||||
|
<< " for patch " << this->patch().name() << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldType& nbrField = sampleField();
|
||||||
|
|
||||||
|
newValues = nbrField.boundaryField()[nbrPatchID];
|
||||||
|
distMap.distribute(newValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappedPatchBase::NEARESTPATCHFACEAMI:
|
||||||
|
{
|
||||||
|
const label nbrPatchID =
|
||||||
|
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
|
||||||
|
|
||||||
|
if (nbrPatchID < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
|
||||||
|
)<< "Unable to find sample patch " << mpp.samplePatch()
|
||||||
|
<< " in region " << mpp.sampleRegion()
|
||||||
|
<< " for patch " << this->patch().name() << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldType& nbrField = sampleField();
|
||||||
|
newValues = nbrField.boundaryField()[nbrPatchID];
|
||||||
|
|
||||||
|
newValues = mpp.AMI().interpolateToSource(newValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappedPatchBase::NEARESTFACE:
|
||||||
|
{
|
||||||
|
const mapDistribute& distMap = mpp.map();
|
||||||
|
|
||||||
|
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
|
||||||
|
|
||||||
|
const fieldType& nbrField = sampleField();
|
||||||
|
|
||||||
|
forAll(nbrField.boundaryField(), patchI)
|
||||||
|
{
|
||||||
|
const fvPatchField<Type>& pf =
|
||||||
|
nbrField.boundaryField()[patchI];
|
||||||
|
label faceStart = pf.patch().start();
|
||||||
|
|
||||||
|
forAll(pf, faceI)
|
||||||
|
{
|
||||||
|
allValues[faceStart++] = pf[faceI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
distMap.distribute(allValues);
|
||||||
|
newValues.transfer(allValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"mappedFixedValueFvPatchField<Type>::updateCoeffs()"
|
||||||
|
)<< "Unknown sampling mode: " << mpp.mode()
|
||||||
|
<< nl << abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setAverage_)
|
||||||
|
{
|
||||||
|
Type averagePsi =
|
||||||
|
gSum(this->patch().magSf()*newValues)
|
||||||
|
/gSum(this->patch().magSf());
|
||||||
|
|
||||||
|
if (mag(averagePsi)/mag(average_) > 0.5)
|
||||||
|
{
|
||||||
|
newValues *= mag(average_)/mag(averagePsi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newValues += (average_ - averagePsi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->operator==(newValues);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "mapped on field:"
|
||||||
|
<< this->dimensionedInternalField().name()
|
||||||
|
<< " patch:" << this->patch().name()
|
||||||
|
<< " avg:" << gAverage(*this)
|
||||||
|
<< " min:" << gMin(*this)
|
||||||
|
<< " max:" << gMax(*this)
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore tag
|
||||||
|
UPstream::msgType() = oldTag;
|
||||||
|
|
||||||
|
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void mappedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::write(os);
|
||||||
|
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("interpolationScheme") << interpolationScheme_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,196 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedFixedValueFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Recycles the value at a set of cells or patch faces back to *this. Can not
|
||||||
|
sample internal faces (since volField not defined on faces).
|
||||||
|
|
||||||
|
mode = NEARESTCELL : sample nearest cell
|
||||||
|
mode = NEARESTPATCHFACE : sample nearest face on selected patch
|
||||||
|
mode = NEARESTFACE : sample nearest face on any patch. Note: does not
|
||||||
|
warn if nearest actually is on internal face!
|
||||||
|
mode = NEARESTPATCHFACEAMI : sample nearest face on selected patch
|
||||||
|
patches can be non-conformal - method uses AMI interpolation
|
||||||
|
|
||||||
|
For NEARESTCELL you have to provide an 'interpolationScheme' entry
|
||||||
|
which can be any one of the interpolation schemes (cell, cellPoint, etc.)
|
||||||
|
In case of interpolation (so scheme != cell) the limitation is that
|
||||||
|
there is only one value per cell. So e.g. if you have a cell with two
|
||||||
|
boundary faces and both faces sample into the cell both faces will get
|
||||||
|
the same value.
|
||||||
|
|
||||||
|
See directMappedPatchBase for options on sampling.
|
||||||
|
|
||||||
|
Optional 'fieldName' entry to supply a different filename
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedFixedValueFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedFixedValueFvPatchField_H
|
||||||
|
#define mappedFixedValueFvPatchField_H
|
||||||
|
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "interpolation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedFixedValueFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class mappedFixedValueFvPatchField
|
||||||
|
:
|
||||||
|
public fixedValueFvPatchField<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of field to sample - defaults to field associated with this
|
||||||
|
// patchField if not specified
|
||||||
|
word fieldName_;
|
||||||
|
|
||||||
|
//- If true adjust the mapped field to maintain average value average_
|
||||||
|
const bool setAverage_;
|
||||||
|
|
||||||
|
//- Average value the mapped field is adjusted to maintain if
|
||||||
|
// setAverage_ is set true
|
||||||
|
const Type average_;
|
||||||
|
|
||||||
|
//- Interpolation scheme to use for nearestcell mode
|
||||||
|
word interpolationScheme_;
|
||||||
|
|
||||||
|
mutable autoPtr<interpolation<Type> > interpolator_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Field to sample. Either on my or nbr mesh
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
|
||||||
|
|
||||||
|
//- Access the interpolation method
|
||||||
|
const interpolation<Type>& interpolator() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("mapped");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given mappedFixedValueFvPatchField
|
||||||
|
// onto a new patch
|
||||||
|
mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedValueFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedValueFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new mappedFixedValueFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
mappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const mappedFixedValueFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- 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 mappedFixedValueFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "mappedFixedValueFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFixedValueFvPatchFields.H"
|
||||||
|
#include "volMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(mappedFixedValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 mappedFixedValueFvPatchFields_H
|
||||||
|
#define mappedFixedValueFvPatchFields_H
|
||||||
|
|
||||||
|
#include "mappedFixedValueFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(mappedFixedValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 mappedFixedValueFvPatchFieldsFwd_H
|
||||||
|
#define mappedFixedValueFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class mappedFixedValueFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(mappedFixedValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedFvPatch.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(mappedFvPatch, 0);
|
||||||
|
addToRunTimeSelectionTable(fvPatch, mappedFvPatch, polyPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedFvPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::mappedFvPatch
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedFvPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedFvPatch_H
|
||||||
|
#define mappedFvPatch_H
|
||||||
|
|
||||||
|
#include "fvPatch.H"
|
||||||
|
#include "mappedPolyPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class mappedFvPatch
|
||||||
|
:
|
||||||
|
public fvPatch
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName(mappedPolyPatch::typeName_());
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
mappedFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
|
||||||
|
:
|
||||||
|
fvPatch(patch, bm)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedWallFvPatch.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(mappedWallFvPatch, 0);
|
||||||
|
addToRunTimeSelectionTable(fvPatch, mappedWallFvPatch, polyPatch);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedWallFvPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::mappedWallFvPatch
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedWallFvPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedWallFvPatch_H
|
||||||
|
#define mappedWallFvPatch_H
|
||||||
|
|
||||||
|
#include "wallFvPatch.H"
|
||||||
|
#include "mappedWallPolyPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedWallFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class mappedWallFvPatch
|
||||||
|
:
|
||||||
|
public wallFvPatch
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName(mappedWallPolyPatch::typeName_());
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
mappedWallFvPatch
|
||||||
|
(
|
||||||
|
const polyPatch& patch,
|
||||||
|
const fvBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallFvPatch(patch, bm)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,992 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedPatchBase.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "ListListOps.H"
|
||||||
|
#include "meshSearch.H"
|
||||||
|
#include "meshTools.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "Random.H"
|
||||||
|
#include "treeDataFace.H"
|
||||||
|
#include "indexedOctree.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "polyPatch.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "mapDistribute.H"
|
||||||
|
#include "SubField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(mappedPatchBase, 0);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::mappedPatchBase::sampleMode,
|
||||||
|
4
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"nearestCell",
|
||||||
|
"nearestPatchFace",
|
||||||
|
"nearestPatchFaceAMI",
|
||||||
|
"nearestFace"
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::mappedPatchBase::offsetMode,
|
||||||
|
3
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"uniform",
|
||||||
|
"nonuniform",
|
||||||
|
"normal"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::mappedPatchBase::sampleMode, 4>
|
||||||
|
Foam::mappedPatchBase::sampleModeNames_;
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::mappedPatchBase::offsetMode, 3>
|
||||||
|
Foam::mappedPatchBase::offsetModeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::mappedPatchBase::collectSamples
|
||||||
|
(
|
||||||
|
pointField& samples,
|
||||||
|
labelList& patchFaceProcs,
|
||||||
|
labelList& patchFaces,
|
||||||
|
pointField& patchFc
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
|
||||||
|
// Collect all sample points and the faces they come from.
|
||||||
|
List<pointField> globalFc(Pstream::nProcs());
|
||||||
|
List<pointField> globalSamples(Pstream::nProcs());
|
||||||
|
labelListList globalFaces(Pstream::nProcs());
|
||||||
|
|
||||||
|
globalFc[Pstream::myProcNo()] = patch_.faceCentres();
|
||||||
|
globalSamples[Pstream::myProcNo()] = samplePoints();
|
||||||
|
globalFaces[Pstream::myProcNo()] = identity(patch_.size());
|
||||||
|
|
||||||
|
// Distribute to all processors
|
||||||
|
Pstream::gatherList(globalSamples);
|
||||||
|
Pstream::scatterList(globalSamples);
|
||||||
|
Pstream::gatherList(globalFaces);
|
||||||
|
Pstream::scatterList(globalFaces);
|
||||||
|
Pstream::gatherList(globalFc);
|
||||||
|
Pstream::scatterList(globalFc);
|
||||||
|
|
||||||
|
// Rework into straight list
|
||||||
|
samples = ListListOps::combine<pointField>
|
||||||
|
(
|
||||||
|
globalSamples,
|
||||||
|
accessOp<pointField>()
|
||||||
|
);
|
||||||
|
patchFaces = ListListOps::combine<labelList>
|
||||||
|
(
|
||||||
|
globalFaces,
|
||||||
|
accessOp<labelList>()
|
||||||
|
);
|
||||||
|
patchFc = ListListOps::combine<pointField>
|
||||||
|
(
|
||||||
|
globalFc,
|
||||||
|
accessOp<pointField>()
|
||||||
|
);
|
||||||
|
|
||||||
|
patchFaceProcs.setSize(patchFaces.size());
|
||||||
|
labelList nPerProc
|
||||||
|
(
|
||||||
|
ListListOps::subSizes
|
||||||
|
(
|
||||||
|
globalFaces,
|
||||||
|
accessOp<labelList>()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
label sampleI = 0;
|
||||||
|
forAll(nPerProc, procI)
|
||||||
|
{
|
||||||
|
for (label i = 0; i < nPerProc[procI]; i++)
|
||||||
|
{
|
||||||
|
patchFaceProcs[sampleI++] = procI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Find the processor/cell containing the samples. Does not account
|
||||||
|
// for samples being found in two processors.
|
||||||
|
void Foam::mappedPatchBase::findSamples
|
||||||
|
(
|
||||||
|
const pointField& samples,
|
||||||
|
labelList& sampleProcs,
|
||||||
|
labelList& sampleIndices,
|
||||||
|
pointField& sampleLocations
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Lookup the correct region
|
||||||
|
const polyMesh& mesh = sampleMesh();
|
||||||
|
|
||||||
|
// All the info for nearest. Construct to miss
|
||||||
|
List<nearInfo> nearest(samples.size());
|
||||||
|
|
||||||
|
switch (mode_)
|
||||||
|
{
|
||||||
|
case NEARESTCELL:
|
||||||
|
{
|
||||||
|
if (samplePatch_.size() && samplePatch_ != "none")
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"mappedPatchBase::findSamples(const pointField&,"
|
||||||
|
" labelList&, labelList&, pointField&) const"
|
||||||
|
) << "No need to supply a patch name when in "
|
||||||
|
<< sampleModeNames_[mode_] << " mode." << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Octree based search engine
|
||||||
|
meshSearch meshSearchEngine(mesh, false);
|
||||||
|
|
||||||
|
forAll(samples, sampleI)
|
||||||
|
{
|
||||||
|
const point& sample = samples[sampleI];
|
||||||
|
|
||||||
|
label cellI = meshSearchEngine.findCell(sample);
|
||||||
|
|
||||||
|
if (cellI == -1)
|
||||||
|
{
|
||||||
|
nearest[sampleI].second().first() = Foam::sqr(GREAT);
|
||||||
|
nearest[sampleI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const point& cc = mesh.cellCentres()[cellI];
|
||||||
|
|
||||||
|
nearest[sampleI].first() = pointIndexHit
|
||||||
|
(
|
||||||
|
true,
|
||||||
|
cc,
|
||||||
|
cellI
|
||||||
|
);
|
||||||
|
nearest[sampleI].second().first() = magSqr(cc-sample);
|
||||||
|
nearest[sampleI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NEARESTPATCHFACE:
|
||||||
|
{
|
||||||
|
Random rndGen(123456);
|
||||||
|
|
||||||
|
const polyPatch& pp = samplePolyPatch();
|
||||||
|
|
||||||
|
if (pp.empty())
|
||||||
|
{
|
||||||
|
forAll(samples, sampleI)
|
||||||
|
{
|
||||||
|
nearest[sampleI].second().first() = Foam::sqr(GREAT);
|
||||||
|
nearest[sampleI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// patch faces
|
||||||
|
const labelList patchFaces(identity(pp.size()) + pp.start());
|
||||||
|
|
||||||
|
treeBoundBox patchBb
|
||||||
|
(
|
||||||
|
treeBoundBox(pp.points(), pp.meshPoints()).extend
|
||||||
|
(
|
||||||
|
rndGen,
|
||||||
|
1E-4
|
||||||
|
)
|
||||||
|
);
|
||||||
|
patchBb.min() -= point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
patchBb.max() += point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
|
||||||
|
|
||||||
|
indexedOctree<treeDataFace> boundaryTree
|
||||||
|
(
|
||||||
|
treeDataFace // all information needed to search faces
|
||||||
|
(
|
||||||
|
false, // do not cache bb
|
||||||
|
mesh,
|
||||||
|
patchFaces // boundary faces only
|
||||||
|
),
|
||||||
|
patchBb, // overall search domain
|
||||||
|
8, // maxLevel
|
||||||
|
10, // leafsize
|
||||||
|
3.0 // duplicity
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(samples, sampleI)
|
||||||
|
{
|
||||||
|
const point& sample = samples[sampleI];
|
||||||
|
|
||||||
|
pointIndexHit& nearInfo = nearest[sampleI].first();
|
||||||
|
nearInfo = boundaryTree.findNearest
|
||||||
|
(
|
||||||
|
sample,
|
||||||
|
magSqr(patchBb.span())
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!nearInfo.hit())
|
||||||
|
{
|
||||||
|
nearest[sampleI].second().first() = Foam::sqr(GREAT);
|
||||||
|
nearest[sampleI].second().second() =
|
||||||
|
Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
point fc(pp[nearInfo.index()].centre(pp.points()));
|
||||||
|
nearInfo.setPoint(fc);
|
||||||
|
nearest[sampleI].second().first() = magSqr(fc-sample);
|
||||||
|
nearest[sampleI].second().second() =
|
||||||
|
Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NEARESTFACE:
|
||||||
|
{
|
||||||
|
if (samplePatch_.size() && samplePatch_ != "none")
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"mappedPatchBase::findSamples(const pointField&,"
|
||||||
|
" labelList&, labelList&, pointField&) const"
|
||||||
|
) << "No need to supply a patch name when in "
|
||||||
|
<< sampleModeNames_[mode_] << " mode." << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Octree based search engine
|
||||||
|
meshSearch meshSearchEngine(mesh, false);
|
||||||
|
|
||||||
|
forAll(samples, sampleI)
|
||||||
|
{
|
||||||
|
const point& sample = samples[sampleI];
|
||||||
|
|
||||||
|
label faceI = meshSearchEngine.findNearestFace(sample);
|
||||||
|
|
||||||
|
if (faceI == -1)
|
||||||
|
{
|
||||||
|
nearest[sampleI].second().first() = Foam::sqr(GREAT);
|
||||||
|
nearest[sampleI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const point& fc = mesh.faceCentres()[faceI];
|
||||||
|
|
||||||
|
nearest[sampleI].first() = pointIndexHit
|
||||||
|
(
|
||||||
|
true,
|
||||||
|
fc,
|
||||||
|
faceI
|
||||||
|
);
|
||||||
|
nearest[sampleI].second().first() = magSqr(fc-sample);
|
||||||
|
nearest[sampleI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NEARESTPATCHFACEAMI:
|
||||||
|
{
|
||||||
|
// nothing to do here
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedPatchBase::findSamples(..)")
|
||||||
|
<< "problem." << abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Find nearest
|
||||||
|
Pstream::listCombineGather(nearest, nearestEqOp());
|
||||||
|
Pstream::listCombineScatter(nearest);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "mappedPatchBase::findSamples on mesh " << sampleRegion_
|
||||||
|
<< " : " << endl;
|
||||||
|
forAll(nearest, sampleI)
|
||||||
|
{
|
||||||
|
label procI = nearest[sampleI].second().second();
|
||||||
|
label localI = nearest[sampleI].first().index();
|
||||||
|
|
||||||
|
Info<< " " << sampleI << " coord:"<< samples[sampleI]
|
||||||
|
<< " found on processor:" << procI
|
||||||
|
<< " in local cell/face:" << localI
|
||||||
|
<< " with cc:" << nearest[sampleI].first().rawPoint() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for samples not being found
|
||||||
|
forAll(nearest, sampleI)
|
||||||
|
{
|
||||||
|
if (!nearest[sampleI].first().hit())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"mappedPatchBase::findSamples"
|
||||||
|
"(const pointField&, labelList&"
|
||||||
|
", labelList&, pointField&)"
|
||||||
|
) << "Did not find sample " << samples[sampleI]
|
||||||
|
<< " on any processor of region " << sampleRegion_
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Convert back into proc+local index
|
||||||
|
sampleProcs.setSize(samples.size());
|
||||||
|
sampleIndices.setSize(samples.size());
|
||||||
|
sampleLocations.setSize(samples.size());
|
||||||
|
|
||||||
|
forAll(nearest, sampleI)
|
||||||
|
{
|
||||||
|
sampleProcs[sampleI] = nearest[sampleI].second().second();
|
||||||
|
sampleIndices[sampleI] = nearest[sampleI].first().index();
|
||||||
|
sampleLocations[sampleI] = nearest[sampleI].first().hitPoint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPatchBase::calcMapping() const
|
||||||
|
{
|
||||||
|
if (mapPtr_.valid())
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedPatchBase::calcMapping() const")
|
||||||
|
<< "Mapping already calculated" << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do a sanity check
|
||||||
|
// Am I sampling my own patch? This only makes sense for a non-zero
|
||||||
|
// offset.
|
||||||
|
bool sampleMyself =
|
||||||
|
(
|
||||||
|
mode_ == NEARESTPATCHFACE
|
||||||
|
&& sampleRegion_ == patch_.boundaryMesh().mesh().name()
|
||||||
|
&& samplePatch_ == patch_.name()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check offset
|
||||||
|
vectorField d(samplePoints()-patch_.faceCentres());
|
||||||
|
if (sampleMyself && gAverage(mag(d)) <= ROOTVSMALL)
|
||||||
|
{
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"mappedPatchBase::mappedPatchBase\n"
|
||||||
|
"(\n"
|
||||||
|
" const polyPatch& pp,\n"
|
||||||
|
" const word& sampleRegion,\n"
|
||||||
|
" const sampleMode mode,\n"
|
||||||
|
" const word& samplePatch,\n"
|
||||||
|
" const vector& offset\n"
|
||||||
|
")\n"
|
||||||
|
) << "Invalid offset " << d << endl
|
||||||
|
<< "Offset is the vector added to the patch face centres to"
|
||||||
|
<< " find the patch face supplying the data." << endl
|
||||||
|
<< "Setting it to " << d
|
||||||
|
<< " on the same patch, on the same region"
|
||||||
|
<< " will find the faces themselves which does not make sense"
|
||||||
|
<< " for anything but testing." << endl
|
||||||
|
<< "patch_:" << patch_.name() << endl
|
||||||
|
<< "sampleRegion_:" << sampleRegion_ << endl
|
||||||
|
<< "mode_:" << sampleModeNames_[mode_] << endl
|
||||||
|
<< "samplePatch_:" << samplePatch_ << endl
|
||||||
|
<< "offsetMode_:" << offsetModeNames_[offsetMode_] << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get global list of all samples and the processor and face they come from.
|
||||||
|
pointField samples;
|
||||||
|
labelList patchFaceProcs;
|
||||||
|
labelList patchFaces;
|
||||||
|
pointField patchFc;
|
||||||
|
collectSamples(samples, patchFaceProcs, patchFaces, patchFc);
|
||||||
|
|
||||||
|
// Find processor and cell/face samples are in and actual location.
|
||||||
|
labelList sampleProcs;
|
||||||
|
labelList sampleIndices;
|
||||||
|
pointField sampleLocations;
|
||||||
|
findSamples(samples, sampleProcs, sampleIndices, sampleLocations);
|
||||||
|
|
||||||
|
|
||||||
|
// Now we have all the data we need:
|
||||||
|
// - where sample originates from (so destination when mapping):
|
||||||
|
// patchFaces, patchFaceProcs.
|
||||||
|
// - cell/face sample is in (so source when mapping)
|
||||||
|
// sampleIndices, sampleProcs.
|
||||||
|
|
||||||
|
//forAll(samples, i)
|
||||||
|
//{
|
||||||
|
// Info<< i << " need data in region "
|
||||||
|
// << patch_.boundaryMesh().mesh().name()
|
||||||
|
// << " for proc:" << patchFaceProcs[i]
|
||||||
|
// << " face:" << patchFaces[i]
|
||||||
|
// << " at:" << patchFc[i] << endl
|
||||||
|
// << "Found data in region " << sampleRegion_
|
||||||
|
// << " at proc:" << sampleProcs[i]
|
||||||
|
// << " face:" << sampleIndices[i]
|
||||||
|
// << " at:" << sampleLocations[i]
|
||||||
|
// << nl << endl;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (debug && Pstream::master())
|
||||||
|
{
|
||||||
|
OFstream str
|
||||||
|
(
|
||||||
|
patch_.boundaryMesh().mesh().time().path()
|
||||||
|
/ patch_.name()
|
||||||
|
+ "_mapped.obj"
|
||||||
|
);
|
||||||
|
Pout<< "Dumping mapping as lines from patch faceCentres to"
|
||||||
|
<< " sampled cell/faceCentres to file " << str.name() << endl;
|
||||||
|
|
||||||
|
label vertI = 0;
|
||||||
|
|
||||||
|
forAll(patchFc, i)
|
||||||
|
{
|
||||||
|
meshTools::writeOBJ(str, patchFc[i]);
|
||||||
|
vertI++;
|
||||||
|
meshTools::writeOBJ(str, sampleLocations[i]);
|
||||||
|
vertI++;
|
||||||
|
str << "l " << vertI-1 << ' ' << vertI << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Determine schedule.
|
||||||
|
mapPtr_.reset(new mapDistribute(sampleProcs, patchFaceProcs));
|
||||||
|
|
||||||
|
// Rework the schedule from indices into samples to cell data to send,
|
||||||
|
// face data to receive.
|
||||||
|
|
||||||
|
labelListList& subMap = mapPtr_().subMap();
|
||||||
|
labelListList& constructMap = mapPtr_().constructMap();
|
||||||
|
|
||||||
|
forAll(subMap, procI)
|
||||||
|
{
|
||||||
|
subMap[procI] = UIndirectList<label>
|
||||||
|
(
|
||||||
|
sampleIndices,
|
||||||
|
subMap[procI]
|
||||||
|
);
|
||||||
|
constructMap[procI] = UIndirectList<label>
|
||||||
|
(
|
||||||
|
patchFaces,
|
||||||
|
constructMap[procI]
|
||||||
|
);
|
||||||
|
|
||||||
|
//if (debug)
|
||||||
|
//{
|
||||||
|
// Pout<< "To proc:" << procI << " sending values of cells/faces:"
|
||||||
|
// << subMap[procI] << endl;
|
||||||
|
// Pout<< "From proc:" << procI
|
||||||
|
// << " receiving values of patch faces:"
|
||||||
|
// << constructMap[procI] << endl;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redo constructSize
|
||||||
|
mapPtr_().constructSize() = patch_.size();
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
// Check that all elements get a value.
|
||||||
|
PackedBoolList used(patch_.size());
|
||||||
|
forAll(constructMap, procI)
|
||||||
|
{
|
||||||
|
const labelList& map = constructMap[procI];
|
||||||
|
|
||||||
|
forAll(map, i)
|
||||||
|
{
|
||||||
|
label faceI = map[i];
|
||||||
|
|
||||||
|
if (used[faceI] == 0)
|
||||||
|
{
|
||||||
|
used[faceI] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedPatchBase::calcMapping() const")
|
||||||
|
<< "On patch " << patch_.name()
|
||||||
|
<< " patchface " << faceI
|
||||||
|
<< " is assigned to more than once."
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
forAll(used, faceI)
|
||||||
|
{
|
||||||
|
if (used[faceI] == 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedPatchBase::calcMapping() const")
|
||||||
|
<< "On patch " << patch_.name()
|
||||||
|
<< " patchface " << faceI
|
||||||
|
<< " is never assigned to."
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::autoPtr<Foam::searchableSurface>& Foam::mappedPatchBase::surfPtr()
|
||||||
|
const
|
||||||
|
{
|
||||||
|
const word surfType(surfDict_.lookupOrDefault<word>("type", "none"));
|
||||||
|
|
||||||
|
if (!surfPtr_.valid() && surfType != "none")
|
||||||
|
{
|
||||||
|
word surfName(surfDict_.lookupOrDefault("name", patch_.name()));
|
||||||
|
|
||||||
|
const polyMesh& mesh = patch_.boundaryMesh().mesh();
|
||||||
|
|
||||||
|
surfPtr_ =
|
||||||
|
searchableSurface::New
|
||||||
|
(
|
||||||
|
surfType,
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
surfName,
|
||||||
|
mesh.time().constant(),
|
||||||
|
"triSurface",
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
surfDict_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return surfPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPatchBase::calcAMI() const
|
||||||
|
{
|
||||||
|
if (AMIPtr_.valid())
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedPatchBase::calcAMI() const")
|
||||||
|
<< "AMI already calculated" << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
AMIPtr_.clear();
|
||||||
|
/*
|
||||||
|
const polyPatch& nbr = samplePolyPatch();
|
||||||
|
|
||||||
|
// pointField nbrPoints(samplePoints());
|
||||||
|
pointField nbrPoints(nbr.localPoints());
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
OFstream os(patch_.name() + "_neighbourPatch-org.obj");
|
||||||
|
meshTools::writeOBJ(os, samplePolyPatch().localFaces(), nbrPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
// transform neighbour patch to local system
|
||||||
|
primitivePatch nbrPatch0
|
||||||
|
(
|
||||||
|
SubList<face>
|
||||||
|
(
|
||||||
|
nbr.localFaces(),
|
||||||
|
nbr.size()
|
||||||
|
),
|
||||||
|
nbrPoints
|
||||||
|
);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
OFstream osN(patch_.name() + "_neighbourPatch-trans.obj");
|
||||||
|
meshTools::writeOBJ(osN, nbrPatch0, nbrPoints);
|
||||||
|
|
||||||
|
OFstream osO(patch_.name() + "_ownerPatch.obj");
|
||||||
|
meshTools::writeOBJ(osO, patch_.localFaces(), patch_.localPoints());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// Construct/apply AMI interpolation to determine addressing and weights
|
||||||
|
AMIPtr_.reset
|
||||||
|
(
|
||||||
|
new AMIPatchToPatchInterpolation
|
||||||
|
(
|
||||||
|
patch_,
|
||||||
|
samplePolyPatch(), // nbrPatch0,
|
||||||
|
surfPtr(),
|
||||||
|
faceAreaIntersect::tmMesh
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_(patch_.boundaryMesh().mesh().name()),
|
||||||
|
mode_(NEARESTPATCHFACE),
|
||||||
|
samplePatch_("none"),
|
||||||
|
offsetMode_(UNIFORM),
|
||||||
|
offset_(vector::zero),
|
||||||
|
offsets_(pp.size(), offset_),
|
||||||
|
distance_(0),
|
||||||
|
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
|
||||||
|
mapPtr_(NULL),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vectorField& offsets
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_(sampleRegion),
|
||||||
|
mode_(mode),
|
||||||
|
samplePatch_(samplePatch),
|
||||||
|
offsetMode_(NONUNIFORM),
|
||||||
|
offset_(vector::zero),
|
||||||
|
offsets_(offsets),
|
||||||
|
distance_(0),
|
||||||
|
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
|
||||||
|
mapPtr_(NULL),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vector& offset
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_(sampleRegion),
|
||||||
|
mode_(mode),
|
||||||
|
samplePatch_(samplePatch),
|
||||||
|
offsetMode_(UNIFORM),
|
||||||
|
offset_(offset),
|
||||||
|
offsets_(0),
|
||||||
|
distance_(0),
|
||||||
|
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
|
||||||
|
mapPtr_(NULL),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const scalar distance
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_(sampleRegion),
|
||||||
|
mode_(mode),
|
||||||
|
samplePatch_(samplePatch),
|
||||||
|
offsetMode_(NORMAL),
|
||||||
|
offset_(vector::zero),
|
||||||
|
offsets_(0),
|
||||||
|
distance_(distance),
|
||||||
|
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
|
||||||
|
mapPtr_(NULL),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dictionary::null)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault
|
||||||
|
(
|
||||||
|
"sampleRegion",
|
||||||
|
patch_.boundaryMesh().mesh().name()
|
||||||
|
)
|
||||||
|
),
|
||||||
|
mode_(sampleModeNames_.read(dict.lookup("sampleMode"))),
|
||||||
|
samplePatch_(dict.lookup("samplePatch")),
|
||||||
|
offsetMode_(UNIFORM),
|
||||||
|
offset_(vector::zero),
|
||||||
|
offsets_(0),
|
||||||
|
distance_(0.0),
|
||||||
|
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
|
||||||
|
mapPtr_(NULL),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dict.subOrEmptyDict("surface"))
|
||||||
|
{
|
||||||
|
if (dict.found("offsetMode"))
|
||||||
|
{
|
||||||
|
offsetMode_ = offsetModeNames_.read(dict.lookup("offsetMode"));
|
||||||
|
|
||||||
|
switch(offsetMode_)
|
||||||
|
{
|
||||||
|
case UNIFORM:
|
||||||
|
{
|
||||||
|
offset_ = point(dict.lookup("offset"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NONUNIFORM:
|
||||||
|
{
|
||||||
|
offsets_ = pointField(dict.lookup("offsets"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NORMAL:
|
||||||
|
{
|
||||||
|
distance_ = readScalar(dict.lookup("distance"));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (dict.found("offset"))
|
||||||
|
{
|
||||||
|
offsetMode_ = UNIFORM;
|
||||||
|
offset_ = point(dict.lookup("offset"));
|
||||||
|
}
|
||||||
|
else if (dict.found("offsets"))
|
||||||
|
{
|
||||||
|
offsetMode_ = NONUNIFORM;
|
||||||
|
offsets_ = pointField(dict.lookup("offsets"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalIOErrorIn
|
||||||
|
(
|
||||||
|
"mappedPatchBase::mappedPatchBase\n"
|
||||||
|
"(\n"
|
||||||
|
" const polyPatch&,\n"
|
||||||
|
" const dictionary&\n"
|
||||||
|
")\n",
|
||||||
|
dict
|
||||||
|
) << "Please supply the offsetMode as one of "
|
||||||
|
<< NamedEnum<offsetMode, 3>::words()
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const mappedPatchBase& dmp
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_(dmp.sampleRegion_),
|
||||||
|
mode_(dmp.mode_),
|
||||||
|
samplePatch_(dmp.samplePatch_),
|
||||||
|
offsetMode_(dmp.offsetMode_),
|
||||||
|
offset_(dmp.offset_),
|
||||||
|
offsets_(dmp.offsets_),
|
||||||
|
distance_(dmp.distance_),
|
||||||
|
sameRegion_(dmp.sameRegion_),
|
||||||
|
mapPtr_(NULL),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dmp.surfDict_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const mappedPatchBase& dmp,
|
||||||
|
const labelUList& mapAddressing
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_(dmp.sampleRegion_),
|
||||||
|
mode_(dmp.mode_),
|
||||||
|
samplePatch_(dmp.samplePatch_),
|
||||||
|
offsetMode_(dmp.offsetMode_),
|
||||||
|
offset_(dmp.offset_),
|
||||||
|
offsets_(dmp.offsets_, mapAddressing),
|
||||||
|
distance_(dmp.distance_),
|
||||||
|
sameRegion_(dmp.sameRegion_),
|
||||||
|
mapPtr_(NULL),
|
||||||
|
AMIPtr_(NULL),
|
||||||
|
surfPtr_(NULL),
|
||||||
|
surfDict_(dmp.surfDict_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::mappedPatchBase::~mappedPatchBase()
|
||||||
|
{
|
||||||
|
clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPatchBase::clearOut()
|
||||||
|
{
|
||||||
|
mapPtr_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::polyMesh& Foam::mappedPatchBase::sampleMesh() const
|
||||||
|
{
|
||||||
|
return patch_.boundaryMesh().mesh().time().lookupObject<polyMesh>
|
||||||
|
(
|
||||||
|
sampleRegion_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::polyPatch& Foam::mappedPatchBase::samplePolyPatch() const
|
||||||
|
{
|
||||||
|
const polyMesh& nbrMesh = sampleMesh();
|
||||||
|
|
||||||
|
const label patchI = nbrMesh.boundaryMesh().findPatchID(samplePatch_);
|
||||||
|
|
||||||
|
if (patchI == -1)
|
||||||
|
{
|
||||||
|
FatalErrorIn("mappedPatchBase::samplePolyPatch()")
|
||||||
|
<< "Cannot find patch " << samplePatch_
|
||||||
|
<< " in region " << sampleRegion_ << endl
|
||||||
|
<< "Valid patches are " << nbrMesh.boundaryMesh().names()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nbrMesh.boundaryMesh()[patchI];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tmp<Foam::pointField> Foam::mappedPatchBase::samplePoints() const
|
||||||
|
{
|
||||||
|
tmp<pointField> tfld(new pointField(patch_.faceCentres()));
|
||||||
|
pointField& fld = tfld();
|
||||||
|
|
||||||
|
switch (offsetMode_)
|
||||||
|
{
|
||||||
|
case UNIFORM:
|
||||||
|
{
|
||||||
|
fld += offset_;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NONUNIFORM:
|
||||||
|
{
|
||||||
|
fld += offsets_;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NORMAL:
|
||||||
|
{
|
||||||
|
// Get outwards pointing normal
|
||||||
|
vectorField n(patch_.faceAreas());
|
||||||
|
n /= mag(n);
|
||||||
|
|
||||||
|
fld += distance_*n;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tfld;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPatchBase::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("sampleMode") << sampleModeNames_[mode_]
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("sampleRegion") << sampleRegion_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("samplePatch") << samplePatch_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("offsetMode") << offsetModeNames_[offsetMode_]
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
switch (offsetMode_)
|
||||||
|
{
|
||||||
|
case UNIFORM:
|
||||||
|
{
|
||||||
|
os.writeKeyword("offset") << offset_ << token::END_STATEMENT << nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NONUNIFORM:
|
||||||
|
{
|
||||||
|
os.writeKeyword("offsets") << offsets_ << token::END_STATEMENT
|
||||||
|
<< nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NORMAL:
|
||||||
|
{
|
||||||
|
os.writeKeyword("distance") << distance_ << token::END_STATEMENT
|
||||||
|
<< nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,395 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedPatchBase
|
||||||
|
|
||||||
|
Description
|
||||||
|
Determines a mapping between patch face centres and mesh cell or face
|
||||||
|
centres and processors they're on.
|
||||||
|
|
||||||
|
If constructed from dictionary:
|
||||||
|
// Region to sample (default is region0)
|
||||||
|
sampleRegion region0;
|
||||||
|
|
||||||
|
// What to sample:
|
||||||
|
// - nearestCell : sample nearest cell
|
||||||
|
// - nearestPatchFace : nearest face on selected patch
|
||||||
|
// - nearestPatchFaceAMI : nearest face on selected patch
|
||||||
|
- patches need not conform
|
||||||
|
- uses AMI interpolation
|
||||||
|
// - nearestFace : nearest boundary face on any patch
|
||||||
|
sampleMode nearestCell;
|
||||||
|
|
||||||
|
// If sampleMod is nearestPatchFace : patch to find faces of
|
||||||
|
samplePatch movingWall;
|
||||||
|
|
||||||
|
// How to supply offset (w.r.t. my patch face centres):
|
||||||
|
// - uniform : single offset vector
|
||||||
|
// - nonuniform : per-face offset vector
|
||||||
|
// - normal : using supplied distance and face normal
|
||||||
|
offsetMode uniform;
|
||||||
|
|
||||||
|
// According to offsetMode (see above) supply one of
|
||||||
|
// offset, offsets or distance
|
||||||
|
offset (1 0 0);
|
||||||
|
|
||||||
|
Note: if offsetMode is 'normal' it uses outwards pointing normals. So
|
||||||
|
supply a negative distance if sampling inside the domain.
|
||||||
|
|
||||||
|
|
||||||
|
Note
|
||||||
|
Storage is not optimal. It temporary collects all (patch)face centres
|
||||||
|
on all processors to keep the addressing calculation simple.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedPatchBase.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedPatchBase_H
|
||||||
|
#define mappedPatchBase_H
|
||||||
|
|
||||||
|
#include "pointField.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
#include "pointIndexHit.H"
|
||||||
|
#include "AMIPatchToPatchInterpolation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class polyPatch;
|
||||||
|
class polyMesh;
|
||||||
|
class mapDistribute;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedPatchBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class mappedPatchBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Type enumerations
|
||||||
|
|
||||||
|
//- Mesh items to sample
|
||||||
|
enum sampleMode
|
||||||
|
{
|
||||||
|
NEARESTCELL, // nearest cell
|
||||||
|
NEARESTPATCHFACE, // faces on selected patch
|
||||||
|
NEARESTPATCHFACEAMI, // nearest patch face + AMI interpolation
|
||||||
|
NEARESTFACE // nearest face
|
||||||
|
};
|
||||||
|
|
||||||
|
//- How to project face centres
|
||||||
|
enum offsetMode
|
||||||
|
{
|
||||||
|
UNIFORM, // single offset vector
|
||||||
|
NONUNIFORM, // per-face offset vector
|
||||||
|
NORMAL // use face normal + distance
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//- Helper class for finding nearest
|
||||||
|
// Nearest:
|
||||||
|
// - point+local index
|
||||||
|
// - sqr(distance)
|
||||||
|
// - processor
|
||||||
|
typedef Tuple2<pointIndexHit, Tuple2<scalar, label> > nearInfo;
|
||||||
|
|
||||||
|
class nearestEqOp
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void operator()(nearInfo& x, const nearInfo& y) const
|
||||||
|
{
|
||||||
|
if (y.first().hit())
|
||||||
|
{
|
||||||
|
if (!x.first().hit())
|
||||||
|
{
|
||||||
|
x = y;
|
||||||
|
}
|
||||||
|
else if (y.second().first() < x.second().first())
|
||||||
|
{
|
||||||
|
x = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
static const NamedEnum<sampleMode, 4> sampleModeNames_;
|
||||||
|
|
||||||
|
static const NamedEnum<offsetMode, 3> offsetModeNames_;
|
||||||
|
|
||||||
|
//- Patch to sample
|
||||||
|
const polyPatch& patch_;
|
||||||
|
|
||||||
|
//- Region to sample
|
||||||
|
const word sampleRegion_;
|
||||||
|
|
||||||
|
//- What to sample
|
||||||
|
const sampleMode mode_;
|
||||||
|
|
||||||
|
//- Patch (only if NEARESTPATCHFACE)
|
||||||
|
const word samplePatch_;
|
||||||
|
|
||||||
|
//- How to obtain samples
|
||||||
|
offsetMode offsetMode_;
|
||||||
|
|
||||||
|
//- Offset vector (uniform)
|
||||||
|
vector offset_;
|
||||||
|
|
||||||
|
//- Offset vector (nonuniform)
|
||||||
|
vectorField offsets_;
|
||||||
|
|
||||||
|
//- Offset distance (normal)
|
||||||
|
scalar distance_;
|
||||||
|
|
||||||
|
//- Same region
|
||||||
|
const bool sameRegion_;
|
||||||
|
|
||||||
|
|
||||||
|
// Derived information
|
||||||
|
|
||||||
|
//- Communication schedule:
|
||||||
|
// - Cells/faces to sample per processor
|
||||||
|
// - Patch faces to receive per processor
|
||||||
|
// - schedule
|
||||||
|
mutable autoPtr<mapDistribute> mapPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
// AMI interpolator
|
||||||
|
|
||||||
|
//- Pointer to AMI interpolator
|
||||||
|
mutable autoPtr<AMIPatchToPatchInterpolation> AMIPtr_;
|
||||||
|
|
||||||
|
//- Pointer to projection surface employed by AMI interpolator
|
||||||
|
mutable autoPtr<searchableSurface> surfPtr_;
|
||||||
|
|
||||||
|
//- Dictionary storing projection surface description
|
||||||
|
dictionary surfDict_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Collect single list of samples and originating processor+face.
|
||||||
|
void collectSamples
|
||||||
|
(
|
||||||
|
pointField&,
|
||||||
|
labelList& patchFaceProcs,
|
||||||
|
labelList& patchFaces,
|
||||||
|
pointField& patchFc
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Find cells/faces containing samples
|
||||||
|
void findSamples
|
||||||
|
(
|
||||||
|
const pointField&,
|
||||||
|
labelList& sampleProcs, // processor containing sample
|
||||||
|
labelList& sampleIndices, // local index of cell/face
|
||||||
|
pointField& sampleLocations // actual representative location
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Calculate mapping
|
||||||
|
void calcMapping() const;
|
||||||
|
|
||||||
|
//- Calculate AMI interpolator
|
||||||
|
void calcAMI() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("mappedPatchBase");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch
|
||||||
|
mappedPatchBase(const polyPatch&);
|
||||||
|
|
||||||
|
//- Construct with offsetMode=non-uniform
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode sampleMode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vectorField& offsets
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from offsetMode=uniform
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode sampleMode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vector& offset
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from offsetMode=normal and distance
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode sampleMode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const scalar distance
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
mappedPatchBase(const polyPatch&, const dictionary&);
|
||||||
|
|
||||||
|
//- Construct as copy, resetting patch
|
||||||
|
mappedPatchBase(const polyPatch&, const mappedPatchBase&);
|
||||||
|
|
||||||
|
//- Construct as copy, resetting patch, map original data
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch&,
|
||||||
|
const mappedPatchBase&,
|
||||||
|
const labelUList& mapAddressing
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~mappedPatchBase();
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
void clearOut();
|
||||||
|
|
||||||
|
//- What to sample
|
||||||
|
const sampleMode& mode() const
|
||||||
|
{
|
||||||
|
return mode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Region to sample
|
||||||
|
const word& sampleRegion() const
|
||||||
|
{
|
||||||
|
return sampleRegion_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Patch (only if NEARESTPATCHFACE)
|
||||||
|
const word& samplePatch() const
|
||||||
|
{
|
||||||
|
return samplePatch_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Offset vector (from patch faces to destination mesh objects)
|
||||||
|
const vector& offset() const
|
||||||
|
{
|
||||||
|
return offset_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Offset vector (from patch faces to destination mesh objects)
|
||||||
|
const vectorField& offsets() const
|
||||||
|
{
|
||||||
|
return offsets_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Wrapper around map/interpolate data distribution
|
||||||
|
template<class Type>
|
||||||
|
void distribute(List<Type>& lst) const
|
||||||
|
{
|
||||||
|
switch (mode_)
|
||||||
|
{
|
||||||
|
case NEARESTPATCHFACEAMI:
|
||||||
|
{
|
||||||
|
lst = AMI().interpolateToSource(Field<Type>(lst.xfer()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
map().distribute(lst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return reference to the parallel distribution map
|
||||||
|
const mapDistribute& map() const
|
||||||
|
{
|
||||||
|
if (mapPtr_.empty())
|
||||||
|
{
|
||||||
|
calcMapping();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mapPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return reference to the AMI interpolator
|
||||||
|
const AMIPatchToPatchInterpolation& AMI(bool forceUpdate = false) const
|
||||||
|
{
|
||||||
|
if (forceUpdate || AMIPtr_.empty())
|
||||||
|
{
|
||||||
|
calcAMI();
|
||||||
|
}
|
||||||
|
|
||||||
|
return AMIPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return a pointer to the AMI projection surface
|
||||||
|
const autoPtr<Foam::searchableSurface>& surfPtr() const;
|
||||||
|
|
||||||
|
//- Cached sampleRegion != mesh.name()
|
||||||
|
bool sameRegion() const
|
||||||
|
{
|
||||||
|
return sameRegion_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Get the region mesh
|
||||||
|
const polyMesh& sampleMesh() const;
|
||||||
|
|
||||||
|
//- Get the patch on the region
|
||||||
|
const polyPatch& samplePolyPatch() const;
|
||||||
|
|
||||||
|
//- Get the sample points
|
||||||
|
tmp<pointField> samplePoints() const;
|
||||||
|
|
||||||
|
//- Write as a dictionary
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,222 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedPolyPatch.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(mappedPolyPatch, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(polyPatch, mappedPolyPatch, word);
|
||||||
|
addToRunTimeSelectionTable(polyPatch, mappedPolyPatch, dictionary);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::mappedPolyPatch::mappedPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
polyPatch(name, size, start, index, bm),
|
||||||
|
mappedPatchBase(static_cast<const polyPatch&>(*this))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPolyPatch::mappedPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vectorField& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
polyPatch(name, size, start, index, bm),
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
static_cast<const polyPatch&>(*this),
|
||||||
|
sampleRegion,
|
||||||
|
mode,
|
||||||
|
samplePatch,
|
||||||
|
offset
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPolyPatch::mappedPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vector& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
polyPatch(name, size, start, index, bm),
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
static_cast<const polyPatch&>(*this),
|
||||||
|
sampleRegion,
|
||||||
|
mode,
|
||||||
|
samplePatch,
|
||||||
|
offset
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPolyPatch::mappedPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
polyPatch(name, dict, index, bm),
|
||||||
|
mappedPatchBase(*this, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPolyPatch::mappedPolyPatch
|
||||||
|
(
|
||||||
|
const mappedPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
polyPatch(pp, bm),
|
||||||
|
mappedPatchBase(*this, pp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPolyPatch::mappedPolyPatch
|
||||||
|
(
|
||||||
|
const mappedPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const label newSize,
|
||||||
|
const label newStart
|
||||||
|
)
|
||||||
|
:
|
||||||
|
polyPatch(pp, bm, index, newSize, newStart),
|
||||||
|
mappedPatchBase(*this, pp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedPolyPatch::mappedPolyPatch
|
||||||
|
(
|
||||||
|
const mappedPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const labelUList& mapAddressing,
|
||||||
|
const label newStart
|
||||||
|
)
|
||||||
|
:
|
||||||
|
polyPatch(pp, bm, index, mapAddressing, newStart),
|
||||||
|
mappedPatchBase(*this, pp, mapAddressing)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::mappedPolyPatch::~mappedPolyPatch()
|
||||||
|
{
|
||||||
|
mappedPatchBase::clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::mappedPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
polyPatch::initGeometry(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
polyPatch::calcGeometry(pBufs);
|
||||||
|
mappedPatchBase::clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPolyPatch::initMovePoints
|
||||||
|
(
|
||||||
|
PstreamBuffers& pBufs,
|
||||||
|
const pointField& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
polyPatch::initMovePoints(pBufs, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPolyPatch::movePoints
|
||||||
|
(
|
||||||
|
PstreamBuffers& pBufs,
|
||||||
|
const pointField& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
polyPatch::movePoints(pBufs, p);
|
||||||
|
mappedPatchBase::clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
polyPatch::initUpdateMesh(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPolyPatch::updateMesh(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
polyPatch::updateMesh(pBufs);
|
||||||
|
mappedPatchBase::clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedPolyPatch::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
polyPatch::write(os);
|
||||||
|
mappedPatchBase::write(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,233 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedPolyPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
Determines a mapping between patch face centres and mesh cell or face
|
||||||
|
centres and processors they're on.
|
||||||
|
|
||||||
|
Note
|
||||||
|
Storage is not optimal. It stores all face centres and cells on all
|
||||||
|
processors to keep the addressing calculation simple.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedPolyPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedPolyPatch_H
|
||||||
|
#define mappedPolyPatch_H
|
||||||
|
|
||||||
|
#include "polyPatch.H"
|
||||||
|
#include "mappedPatchBase.H"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class polyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedPolyPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class mappedPolyPatch
|
||||||
|
:
|
||||||
|
public polyPatch,
|
||||||
|
public mappedPatchBase
|
||||||
|
{
|
||||||
|
|
||||||
|
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&, 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
|
||||||
|
TypeName("mappedPatch");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
mappedPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
mappedPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vectorField& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components. Uniform offset.
|
||||||
|
mappedPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vector& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
mappedPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy, resetting the boundary mesh
|
||||||
|
mappedPolyPatch
|
||||||
|
(
|
||||||
|
const mappedPolyPatch&,
|
||||||
|
const polyBoundaryMesh&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given the original patch and resetting the
|
||||||
|
// face list and boundary mesh information
|
||||||
|
mappedPolyPatch
|
||||||
|
(
|
||||||
|
const mappedPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const label newSize,
|
||||||
|
const label newStart
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given the original patch and a map
|
||||||
|
mappedPolyPatch
|
||||||
|
(
|
||||||
|
const mappedPolyPatch& 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 mappedPolyPatch(*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 mappedPolyPatch(*this, bm, index, newSize, newStart)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- 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 mappedPolyPatch
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
bm,
|
||||||
|
index,
|
||||||
|
mapAddressing,
|
||||||
|
newStart
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~mappedPolyPatch();
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Write the polyPatch data as a dictionary
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,172 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedVariableThicknessWallPolyPatch.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(mappedVariableThicknessWallPolyPatch, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
polyPatch,
|
||||||
|
mappedVariableThicknessWallPolyPatch,
|
||||||
|
word
|
||||||
|
);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
polyPatch,
|
||||||
|
mappedVariableThicknessWallPolyPatch,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedWallPolyPatch(name, size, start, index, bm),
|
||||||
|
thickness_(size)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vectorField& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedWallPolyPatch(name, size, start, index, bm),
|
||||||
|
thickness_(size)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vector& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedWallPolyPatch(name, size, start, index, bm),
|
||||||
|
thickness_(size)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedWallPolyPatch(name, dict, index, bm),
|
||||||
|
thickness_(scalarField("thickness", dict, this->size()))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch::
|
||||||
|
mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedVariableThicknessWallPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedWallPolyPatch(pp, bm),
|
||||||
|
thickness_(pp.thickness_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedVariableThicknessWallPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const label newSize,
|
||||||
|
const label newStart
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedWallPolyPatch(pp, bm, index, newSize, newStart),
|
||||||
|
thickness_(newSize)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedVariableThicknessWallPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const labelUList& mapAddressing,
|
||||||
|
const label newStart
|
||||||
|
)
|
||||||
|
:
|
||||||
|
mappedWallPolyPatch(pp, bm, index, mapAddressing, newStart),
|
||||||
|
thickness_(pp.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch::
|
||||||
|
~mappedVariableThicknessWallPolyPatch()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::mappedVariableThicknessWallPolyPatch::
|
||||||
|
write(Foam::Ostream& os) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("thickness") << thickness_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,236 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedVariableThicknessWallPolyPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
Foam::mappedVariableThicknessWallPolyPatch
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedVariableThicknessWallPolyPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedVariableThicknessWallPolyPatch_H
|
||||||
|
#define mappedVariableThicknessWallPolyPatch_H
|
||||||
|
|
||||||
|
#include "wallPolyPatch.H"
|
||||||
|
#include "mappedWallPolyPatch.H"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class polyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedVariableThicknessWallPolyPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class mappedVariableThicknessWallPolyPatch
|
||||||
|
:
|
||||||
|
public mappedWallPolyPatch
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Thickness
|
||||||
|
scalarList thickness_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("mappedWallVariableThickness");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vectorField& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components. Uniform offset.
|
||||||
|
mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vector& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy, resetting the boundary mesh
|
||||||
|
mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedVariableThicknessWallPolyPatch&,
|
||||||
|
const polyBoundaryMesh&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given the original patch and resetting the
|
||||||
|
// face list and boundary mesh information
|
||||||
|
mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedVariableThicknessWallPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const label newSize,
|
||||||
|
const label newStart
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given the original patch and a map
|
||||||
|
mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedVariableThicknessWallPolyPatch& 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 mappedVariableThicknessWallPolyPatch(*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 mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
bm,
|
||||||
|
index,
|
||||||
|
newSize,
|
||||||
|
newStart
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- 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 mappedVariableThicknessWallPolyPatch
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
bm,
|
||||||
|
index,
|
||||||
|
mapAddressing,
|
||||||
|
newStart
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~mappedVariableThicknessWallPolyPatch();
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Return non const thickness
|
||||||
|
scalarList& thickness()
|
||||||
|
{
|
||||||
|
return thickness_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Return const thickness
|
||||||
|
const scalarList& thickness() const
|
||||||
|
{
|
||||||
|
return thickness_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Write the polyPatch data as a dictionary
|
||||||
|
void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedWallPointPatch.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(mappedWallPointPatch, 0);
|
||||||
|
|
||||||
|
// Add the patch constructor functions to the hash tables
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
facePointPatch,
|
||||||
|
mappedWallPointPatch,
|
||||||
|
polyPatch
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedWallPointPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
mappedWallPointPatch patch.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedWallPointPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedWallPointPatch_H
|
||||||
|
#define mappedWallPointPatch_H
|
||||||
|
|
||||||
|
#include "wallPointPatch.H"
|
||||||
|
#include "mappedWallPolyPatch.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedWallPointPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class mappedWallPointPatch
|
||||||
|
:
|
||||||
|
public wallPointPatch
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName(mappedWallPolyPatch::typeName_());
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from polyPatch
|
||||||
|
mappedWallPointPatch
|
||||||
|
(
|
||||||
|
const polyPatch& patch,
|
||||||
|
const pointBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallPointPatch(patch, bm)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,227 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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 "mappedWallPolyPatch.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(mappedWallPolyPatch, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable(polyPatch, mappedWallPolyPatch, word);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
polyPatch,
|
||||||
|
mappedWallPolyPatch,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallPolyPatch(name, size, start, index, bm),
|
||||||
|
mappedPatchBase(static_cast<const polyPatch&>(*this))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vectorField& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallPolyPatch(name, size, start, index, bm),
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
static_cast<const polyPatch&>(*this),
|
||||||
|
sampleRegion,
|
||||||
|
mode,
|
||||||
|
samplePatch,
|
||||||
|
offset
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vector& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallPolyPatch(name, size, start, index, bm),
|
||||||
|
mappedPatchBase
|
||||||
|
(
|
||||||
|
static_cast<const polyPatch&>(*this),
|
||||||
|
sampleRegion,
|
||||||
|
mode,
|
||||||
|
samplePatch,
|
||||||
|
offset
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallPolyPatch(name, dict, index, bm),
|
||||||
|
mappedPatchBase(*this, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedWallPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallPolyPatch(pp, bm),
|
||||||
|
mappedPatchBase(*this, pp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedWallPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const label newSize,
|
||||||
|
const label newStart
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallPolyPatch(pp, bm, index, newSize, newStart),
|
||||||
|
mappedPatchBase(*this, pp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedWallPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const labelUList& mapAddressing,
|
||||||
|
const label newStart
|
||||||
|
)
|
||||||
|
:
|
||||||
|
wallPolyPatch(pp, bm, index, mapAddressing, newStart),
|
||||||
|
mappedPatchBase(*this, pp, mapAddressing)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::mappedWallPolyPatch::~mappedWallPolyPatch()
|
||||||
|
{
|
||||||
|
mappedPatchBase::clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::mappedWallPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
wallPolyPatch::initGeometry(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedWallPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
wallPolyPatch::calcGeometry(pBufs);
|
||||||
|
mappedPatchBase::clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedWallPolyPatch::initMovePoints
|
||||||
|
(
|
||||||
|
PstreamBuffers& pBufs,
|
||||||
|
const pointField& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wallPolyPatch::initMovePoints(pBufs, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedWallPolyPatch::movePoints
|
||||||
|
(
|
||||||
|
PstreamBuffers& pBufs,
|
||||||
|
const pointField& p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
wallPolyPatch::movePoints(pBufs, p);
|
||||||
|
mappedPatchBase::clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedWallPolyPatch::initUpdateMesh(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
wallPolyPatch::initUpdateMesh(pBufs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedWallPolyPatch::updateMesh(PstreamBuffers& pBufs)
|
||||||
|
{
|
||||||
|
wallPolyPatch::updateMesh(pBufs);
|
||||||
|
mappedPatchBase::clearOut();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::mappedWallPolyPatch::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
wallPolyPatch::write(os);
|
||||||
|
mappedPatchBase::write(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,240 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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::mappedWallPolyPatch
|
||||||
|
|
||||||
|
Description
|
||||||
|
Determines a mapping between patch face centres and mesh cell or face
|
||||||
|
centres and processors they're on.
|
||||||
|
|
||||||
|
Note
|
||||||
|
Storage is not optimal. It stores all face centres and cells on all
|
||||||
|
processors to keep the addressing calculation simple.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
mappedWallPolyPatch.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef mappedWallPolyPatch_H
|
||||||
|
#define mappedWallPolyPatch_H
|
||||||
|
|
||||||
|
#include "wallPolyPatch.H"
|
||||||
|
#include "mappedPatchBase.H"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
class polyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class mappedWallPolyPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class mappedWallPolyPatch
|
||||||
|
:
|
||||||
|
public wallPolyPatch,
|
||||||
|
public mappedPatchBase
|
||||||
|
{
|
||||||
|
|
||||||
|
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&, 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
|
||||||
|
TypeName("mappedWall");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vectorField& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components. Uniform offset.
|
||||||
|
mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const mappedPatchBase::sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const vector& offset,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from dictionary
|
||||||
|
mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy, resetting the boundary mesh
|
||||||
|
mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedWallPolyPatch&,
|
||||||
|
const polyBoundaryMesh&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given the original patch and resetting the
|
||||||
|
// face list and boundary mesh information
|
||||||
|
mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedWallPolyPatch& pp,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const label index,
|
||||||
|
const label newSize,
|
||||||
|
const label newStart
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given the original patch and a map
|
||||||
|
mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
const mappedWallPolyPatch& 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 mappedWallPolyPatch(*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 mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
bm,
|
||||||
|
index,
|
||||||
|
newSize,
|
||||||
|
newStart
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- 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 mappedWallPolyPatch
|
||||||
|
(
|
||||||
|
*this,
|
||||||
|
bm,
|
||||||
|
index,
|
||||||
|
mapAddressing,
|
||||||
|
newStart
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~mappedWallPolyPatch();
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
//- Write the polyPatch data as a dictionary
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -50,6 +50,8 @@ wmake $makeType conversion
|
|||||||
|
|
||||||
wmake $makeType sampling
|
wmake $makeType sampling
|
||||||
|
|
||||||
|
wmake $makeType AMIInterpolation
|
||||||
|
|
||||||
wmake $makeType dynamicMesh
|
wmake $makeType dynamicMesh
|
||||||
wmake $makeType dynamicFvMesh
|
wmake $makeType dynamicFvMesh
|
||||||
wmake $makeType topoChangerFvMesh
|
wmake $makeType topoChangerFvMesh
|
||||||
|
|||||||
@ -21,10 +21,6 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Description
|
|
||||||
Interpolation class dealing with transfer of data between two
|
|
||||||
primitivePatches
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "PatchToPatchInterpolation.H"
|
#include "PatchToPatchInterpolation.H"
|
||||||
|
|||||||
@ -163,6 +163,15 @@ Foam::tmp<Foam::pointField> Foam::boundBox::points() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::boundBox::inflate(const scalar s)
|
||||||
|
{
|
||||||
|
vector ext = vector::one*s*mag();
|
||||||
|
|
||||||
|
min_ -= ext;
|
||||||
|
max_ += ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::boundBox::contains(const UList<point>& points) const
|
bool Foam::boundBox::contains(const UList<point>& points) const
|
||||||
{
|
{
|
||||||
if (points.empty())
|
if (points.empty())
|
||||||
|
|||||||
@ -160,6 +160,13 @@ public:
|
|||||||
//- Return corner points in an order corresponding to a 'hex' cell
|
//- Return corner points in an order corresponding to a 'hex' cell
|
||||||
tmp<pointField> points() const;
|
tmp<pointField> points() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Manipulate
|
||||||
|
|
||||||
|
//- Inflate box by factor*mag(span) in all dimensions
|
||||||
|
void inflate(const scalar s);
|
||||||
|
|
||||||
|
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
//- Overlaps/touches boundingBox?
|
//- Overlaps/touches boundingBox?
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Function matchPoints Declaration
|
Function matchPoints Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
//- Determine correspondence between pointFields. Gets passed
|
//- Determine correspondence between pointFields. Gets passed
|
||||||
|
|||||||
@ -244,10 +244,10 @@ void Foam::coupledPolyPatch::calcTransformTensors
|
|||||||
|
|
||||||
if (Cf.size() == 0)
|
if (Cf.size() == 0)
|
||||||
{
|
{
|
||||||
// Dummy geometry.
|
// Dummy geometry. Assume non-separated, parallel.
|
||||||
separation_.setSize(0);
|
separation_.setSize(0);
|
||||||
forwardT_ = I;
|
forwardT_.clear();
|
||||||
reverseT_ = I;
|
reverseT_.clear();
|
||||||
collocated_.setSize(0);
|
collocated_.setSize(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -87,6 +87,7 @@ private:
|
|||||||
//- Are faces collocated. Either size 0,1 or length of patch.
|
//- Are faces collocated. Either size 0,1 or length of patch.
|
||||||
mutable boolList collocated_;
|
mutable boolList collocated_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|||||||
@ -27,6 +27,9 @@ License
|
|||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "transformField.H"
|
#include "transformField.H"
|
||||||
|
#include "cellZoneMesh.H"
|
||||||
|
#include "boolList.H"
|
||||||
|
#include "syncTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -67,10 +70,61 @@ Foam::solidBodyMotionFvMesh::solidBodyMotionFvMesh(const IOobject& io)
|
|||||||
meshSubDir,
|
meshSubDir,
|
||||||
*this,
|
*this,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
{}
|
pointIDs_()
|
||||||
|
{
|
||||||
|
word cellZoneName =
|
||||||
|
dynamicMeshCoeffs_.lookupOrDefault<word>("cellZone", "none");
|
||||||
|
|
||||||
|
if (cellZoneName != "none")
|
||||||
|
{
|
||||||
|
label zoneI = cellZones().findZoneID(cellZoneName);
|
||||||
|
Info<< "Applying solid body motion to cellZone " << cellZoneName
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
const cellZone& cz = cellZones()[zoneI];
|
||||||
|
|
||||||
|
|
||||||
|
// collect point IDs of points in cell zone
|
||||||
|
|
||||||
|
boolList movePts(nPoints(), false);
|
||||||
|
|
||||||
|
forAll(cz, i)
|
||||||
|
{
|
||||||
|
label cellI = cz[i];
|
||||||
|
const cell& c = cells()[cellI];
|
||||||
|
forAll(c, j)
|
||||||
|
{
|
||||||
|
const face& f = faces()[c[j]];
|
||||||
|
forAll(f, k)
|
||||||
|
{
|
||||||
|
label pointI = f[k];
|
||||||
|
movePts[pointI] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
syncTools::syncPointList(*this, movePts, orEqOp<bool>(), false);
|
||||||
|
|
||||||
|
DynamicList<label> ptIDs(nPoints());
|
||||||
|
forAll(movePts, i)
|
||||||
|
{
|
||||||
|
if (movePts[i])
|
||||||
|
{
|
||||||
|
ptIDs.append(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pointIDs_.transfer(ptIDs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info<< "Applying solid body motion to entire mesh" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
@ -85,14 +139,31 @@ bool Foam::solidBodyMotionFvMesh::update()
|
|||||||
{
|
{
|
||||||
static bool hasWarned = false;
|
static bool hasWarned = false;
|
||||||
|
|
||||||
fvMesh::movePoints
|
if (pointIDs_.size() > 0)
|
||||||
(
|
{
|
||||||
transform
|
pointField transformedPts(undisplacedPoints_);
|
||||||
|
|
||||||
|
UIndirectList<point>(transformedPts, pointIDs_) =
|
||||||
|
transform
|
||||||
|
(
|
||||||
|
SBMFPtr_().transformation(),
|
||||||
|
pointField(transformedPts, pointIDs_)
|
||||||
|
);
|
||||||
|
|
||||||
|
fvMesh::movePoints(transformedPts);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fvMesh::movePoints
|
||||||
(
|
(
|
||||||
SBMFPtr_().transformation(),
|
transform
|
||||||
undisplacedPoints_
|
(
|
||||||
)
|
SBMFPtr_().transformation(),
|
||||||
);
|
undisplacedPoints_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (foundObject<volVectorField>("U"))
|
if (foundObject<volVectorField>("U"))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class solidBodyMotionFvMesh Declaration
|
Class solidBodyMotionFvMesh Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class solidBodyMotionFvMesh
|
class solidBodyMotionFvMesh
|
||||||
@ -65,6 +65,9 @@ class solidBodyMotionFvMesh
|
|||||||
//- The reference points which are transformed
|
//- The reference points which are transformed
|
||||||
pointIOField undisplacedPoints_;
|
pointIOField undisplacedPoints_;
|
||||||
|
|
||||||
|
//- Points to move when cell zone is supplied
|
||||||
|
labelList pointIDs_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -170,7 +170,7 @@ public:
|
|||||||
|
|
||||||
// Cyclic coupled interface functions
|
// Cyclic coupled interface functions
|
||||||
|
|
||||||
//- Does the patch field perform the transfromation
|
//- Does the patch field perform the transformation
|
||||||
virtual bool doTransform() const
|
virtual bool doTransform() const
|
||||||
{
|
{
|
||||||
return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
|
return !(cyclicPatch_.parallel() || pTraits<Type>::rank == 0);
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
|
-I$(LIB_SRC)/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||||
@ -14,16 +16,18 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels \
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
-lsampling \
|
||||||
|
-lAMIInterpolation \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-llagrangianIntermediate \
|
-llagrangianIntermediate \
|
||||||
@ -36,7 +40,12 @@ LIB_LIBS = \
|
|||||||
-lsolidMixtureProperties \
|
-lsolidMixtureProperties \
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lSLGThermo \
|
-lSLGThermo \
|
||||||
|
-lradiationModels \
|
||||||
|
-lcompressibleTurbulenceModel \
|
||||||
-lcompressibleRASModels \
|
-lcompressibleRASModels \
|
||||||
-lcompressibleLESModels \
|
-lcompressibleLESModels \
|
||||||
|
-lLESdeltas \
|
||||||
-lregionModels \
|
-lregionModels \
|
||||||
-lsurfaceFilmModels
|
-lsurfaceFilmModels \
|
||||||
|
-ldynamicFvMesh
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
|
-I$(LIB_SRC)/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||||
@ -13,33 +15,35 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels \
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
-lsampling \
|
||||||
|
-lAMIInterpolation \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-ldistributionModels \
|
-ldistributionModels \
|
||||||
|
-lspecie \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
-lliquidProperties \
|
-lliquidProperties \
|
||||||
-lliquidMixtureProperties \
|
-lliquidMixtureProperties \
|
||||||
-lsolidProperties \
|
-lsolidProperties \
|
||||||
-lsolidMixtureProperties \
|
-lsolidMixtureProperties \
|
||||||
-lspecie \
|
|
||||||
-lbasicThermophysicalModels \
|
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lSLGThermo \
|
-lSLGThermo \
|
||||||
-lchemistryModel \
|
|
||||||
-lradiationModels \
|
-lradiationModels \
|
||||||
-lODE \
|
-lcompressibleTurbulenceModel \
|
||||||
-lcompressibleRASModels \
|
-lcompressibleRASModels \
|
||||||
-lcompressibleLESModels \
|
-lcompressibleLESModels \
|
||||||
-ldynamicFvMesh \
|
-lLESdeltas \
|
||||||
-lsurfaceFilmModels
|
-lregionModels \
|
||||||
|
-lsurfaceFilmModels \
|
||||||
|
-ldynamicFvMesh
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ License
|
|||||||
#include "SurfaceFilmModel.H"
|
#include "SurfaceFilmModel.H"
|
||||||
#include "surfaceFilmModel.H"
|
#include "surfaceFilmModel.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "directMappedWallPolyPatch.H"
|
#include "mappedPatchBase.H"
|
||||||
|
|
||||||
using namespace Foam::constant;
|
using namespace Foam::constant;
|
||||||
|
|
||||||
@ -156,13 +156,11 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
|
|||||||
const label filmPatchI = filmPatches[i];
|
const label filmPatchI = filmPatches[i];
|
||||||
const label primaryPatchI = primaryPatches[i];
|
const label primaryPatchI = primaryPatches[i];
|
||||||
|
|
||||||
const directMappedPatchBase& mapPatch =
|
const mappedPatchBase& mapPatch = filmModel.mappedPatches()[filmPatchI];
|
||||||
filmModel.mappedPatches()[filmPatchI];
|
|
||||||
const mapDistribute& distMap = mapPatch.map();
|
|
||||||
|
|
||||||
const labelList& injectorCellsPatch = pbm[primaryPatchI].faceCells();
|
const labelList& injectorCellsPatch = pbm[primaryPatchI].faceCells();
|
||||||
|
|
||||||
cacheFilmFields(filmPatchI, primaryPatchI, distMap, filmModel);
|
cacheFilmFields(filmPatchI, primaryPatchI, mapPatch, filmModel);
|
||||||
|
|
||||||
const vectorField& Cf = mesh.C().boundaryField()[primaryPatchI];
|
const vectorField& Cf = mesh.C().boundaryField()[primaryPatchI];
|
||||||
const vectorField& Sf = mesh.Sf().boundaryField()[primaryPatchI];
|
const vectorField& Sf = mesh.Sf().boundaryField()[primaryPatchI];
|
||||||
@ -229,26 +227,26 @@ void Foam::SurfaceFilmModel<CloudType>::cacheFilmFields
|
|||||||
(
|
(
|
||||||
const label filmPatchI,
|
const label filmPatchI,
|
||||||
const label primaryPatchI,
|
const label primaryPatchI,
|
||||||
const mapDistribute& distMap,
|
const mappedPatchBase& mapPatch,
|
||||||
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
|
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
massParcelPatch_ = filmModel.cloudMassTrans().boundaryField()[filmPatchI];
|
massParcelPatch_ = filmModel.cloudMassTrans().boundaryField()[filmPatchI];
|
||||||
distMap.distribute(massParcelPatch_);
|
mapPatch.distribute(massParcelPatch_);
|
||||||
|
|
||||||
diameterParcelPatch_ =
|
diameterParcelPatch_ =
|
||||||
filmModel.cloudDiameterTrans().boundaryField()[filmPatchI];
|
filmModel.cloudDiameterTrans().boundaryField()[filmPatchI];
|
||||||
distMap.distribute(diameterParcelPatch_);
|
mapPatch.distribute(diameterParcelPatch_);
|
||||||
|
|
||||||
UFilmPatch_ = filmModel.Us().boundaryField()[filmPatchI];
|
UFilmPatch_ = filmModel.Us().boundaryField()[filmPatchI];
|
||||||
distMap.distribute(UFilmPatch_);
|
mapPatch.distribute(UFilmPatch_);
|
||||||
|
|
||||||
rhoFilmPatch_ = filmModel.rho().boundaryField()[filmPatchI];
|
rhoFilmPatch_ = filmModel.rho().boundaryField()[filmPatchI];
|
||||||
distMap.distribute(rhoFilmPatch_);
|
mapPatch.distribute(rhoFilmPatch_);
|
||||||
|
|
||||||
deltaFilmPatch_[primaryPatchI] =
|
deltaFilmPatch_[primaryPatchI] =
|
||||||
filmModel.delta().boundaryField()[filmPatchI];
|
filmModel.delta().boundaryField()[filmPatchI];
|
||||||
distMap.distribute(deltaFilmPatch_[primaryPatchI]);
|
mapPatch.distribute(deltaFilmPatch_[primaryPatchI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ namespace regionModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class mapDistribute;
|
class mappedPatchBase;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class SurfaceFilmModel Declaration
|
Class SurfaceFilmModel Declaration
|
||||||
@ -116,7 +116,7 @@ protected:
|
|||||||
(
|
(
|
||||||
const label filmPatchI,
|
const label filmPatchI,
|
||||||
const label primaryPatchI,
|
const label primaryPatchI,
|
||||||
const mapDistribute& distMap,
|
const mappedPatchBase& mapPatch,
|
||||||
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
|
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -620,8 +620,9 @@ bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
|
|||||||
(
|
(
|
||||||
"bool ThermoSurfaceFilm<CloudType>::transferParcel"
|
"bool ThermoSurfaceFilm<CloudType>::transferParcel"
|
||||||
"("
|
"("
|
||||||
"const parcelType&, "
|
"parcelType&, "
|
||||||
"const label"
|
"const polyPatch&, "
|
||||||
|
"bool&"
|
||||||
")"
|
")"
|
||||||
) << "Unknown interaction type enumeration"
|
) << "Unknown interaction type enumeration"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
@ -642,7 +643,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
|
|||||||
(
|
(
|
||||||
const label filmPatchI,
|
const label filmPatchI,
|
||||||
const label primaryPatchI,
|
const label primaryPatchI,
|
||||||
const mapDistribute& distMap,
|
const mappedPatchBase& mapPatch,
|
||||||
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
|
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -650,15 +651,15 @@ void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
|
|||||||
(
|
(
|
||||||
filmPatchI,
|
filmPatchI,
|
||||||
primaryPatchI,
|
primaryPatchI,
|
||||||
distMap,
|
mapPatch,
|
||||||
filmModel
|
filmModel
|
||||||
);
|
);
|
||||||
|
|
||||||
TFilmPatch_ = filmModel.Ts().boundaryField()[filmPatchI];
|
TFilmPatch_ = filmModel.Ts().boundaryField()[filmPatchI];
|
||||||
distMap.distribute(TFilmPatch_);
|
mapPatch.distribute(TFilmPatch_);
|
||||||
|
|
||||||
CpFilmPatch_ = filmModel.Cp().boundaryField()[filmPatchI];
|
CpFilmPatch_ = filmModel.Cp().boundaryField()[filmPatchI];
|
||||||
distMap.distribute(CpFilmPatch_);
|
mapPatch.distribute(CpFilmPatch_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -227,7 +227,7 @@ protected:
|
|||||||
(
|
(
|
||||||
const label filmPatchI,
|
const label filmPatchI,
|
||||||
const label primaryPatchI,
|
const label primaryPatchI,
|
||||||
const mapDistribute& distMap,
|
const mappedPatchBase& distMap,
|
||||||
const regionModels::surfaceFilmModels::surfaceFilmModel&
|
const regionModels::surfaceFilmModels::surfaceFilmModel&
|
||||||
filmModel
|
filmModel
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
|
-I$(LIB_SRC)/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
|
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
||||||
|
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \
|
||||||
@ -10,37 +15,37 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
|
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
|
||||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
|
|
||||||
-I$(LIB_SRC)/turbulenceModels \
|
-I$(LIB_SRC)/turbulenceModels \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||||
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
-lsampling \
|
||||||
|
-lAMIInterpolation \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldistributionModels \
|
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-llagrangianIntermediate \
|
-llagrangianIntermediate \
|
||||||
|
-ldistributionModels \
|
||||||
|
-lspecie \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
-lliquidProperties \
|
-lliquidProperties \
|
||||||
-lliquidMixtureProperties \
|
-lliquidMixtureProperties \
|
||||||
-lsolidProperties \
|
-lsolidProperties \
|
||||||
-lsolidMixtureProperties \
|
-lsolidMixtureProperties \
|
||||||
-lspecie \
|
|
||||||
-lbasicThermophysicalModels \
|
|
||||||
-lreactionThermophysicalModels \
|
-lreactionThermophysicalModels \
|
||||||
-lSLGThermo \
|
-lSLGThermo \
|
||||||
-lchemistryModel \
|
|
||||||
-lradiationModels \
|
-lradiationModels \
|
||||||
-lODE \
|
-lcompressibleTurbulenceModel \
|
||||||
-lcompressibleRASModels \
|
-lcompressibleRASModels \
|
||||||
-lcompressibleLESModels \
|
-lcompressibleLESModels \
|
||||||
-ldynamicFvMesh \
|
-lLESdeltas \
|
||||||
-lsurfaceFilmModels
|
-lregionModels \
|
||||||
|
-lsurfaceFilmModels \
|
||||||
|
-ldynamicFvMesh
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
// Data types
|
// Data types
|
||||||
|
|
||||||
//- volume types
|
//- Volume types
|
||||||
enum volumeType
|
enum volumeType
|
||||||
{
|
{
|
||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
@ -83,6 +83,7 @@ public:
|
|||||||
|
|
||||||
static const NamedEnum<volumeType, 4> volumeTypeNames;
|
static const NamedEnum<volumeType, 4> volumeTypeNames;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
@ -188,16 +189,16 @@ public:
|
|||||||
return bounds_;
|
return bounds_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Names of regions.
|
//- Names of regions
|
||||||
virtual const wordList& regions() const = 0;
|
virtual const wordList& regions() const = 0;
|
||||||
|
|
||||||
//- Whether supports volume type below.
|
//- Whether supports volume type below
|
||||||
virtual bool hasVolumeType() const = 0;
|
virtual bool hasVolumeType() const = 0;
|
||||||
|
|
||||||
//- Range of local indices that can be returned.
|
//- Range of local indices that can be returned
|
||||||
virtual label size() const = 0;
|
virtual label size() const = 0;
|
||||||
|
|
||||||
//- Range of global indices that can be returned.
|
//- Range of global indices that can be returned
|
||||||
virtual label globalSize() const
|
virtual label globalSize() const
|
||||||
{
|
{
|
||||||
return size();
|
return size();
|
||||||
@ -350,7 +351,6 @@ public:
|
|||||||
{
|
{
|
||||||
values.clear();
|
values.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
|
-I$(LIB_SRC)/AMIInterpolation/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
|
||||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||||
@ -14,11 +16,19 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
|
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
|
||||||
|
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lregionModels \
|
|
||||||
-lsolidChemistryModel \
|
|
||||||
-lbasicSolidThermo \
|
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
-lsampling \
|
||||||
|
-lAMIInterpolation \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-lcompressibleLESModels
|
-lchemistryModel \
|
||||||
|
-lspecie \
|
||||||
|
-lspecie \
|
||||||
|
-lsolid \
|
||||||
|
-lbasicThermophysicalModels \
|
||||||
|
-lsolidChemistryModel \
|
||||||
|
-lcompressibleTurbulenceModel \
|
||||||
|
-lcompressibleRASModels \
|
||||||
|
-lcompressibleLESModels \
|
||||||
|
-lLESdeltas \
|
||||||
|
-lregionModels
|
||||||
|
|||||||
@ -25,7 +25,7 @@ License
|
|||||||
|
|
||||||
#include "pyrolysisModel.H"
|
#include "pyrolysisModel.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "directMappedFieldFvPatchField.H"
|
#include "mappedFieldFvPatchField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ void pyrolysisModel::constructMeshObjects()
|
|||||||
forAll(filmDelta.boundaryField(), patchI)
|
forAll(filmDelta.boundaryField(), patchI)
|
||||||
{
|
{
|
||||||
const fvPatchField<scalar>& fvp = filmDelta.boundaryField()[patchI];
|
const fvPatchField<scalar>& fvp = filmDelta.boundaryField()[patchI];
|
||||||
if (isA<directMappedFieldFvPatchField<scalar> >(fvp))
|
if (isA<mappedFieldFvPatchField<scalar> >(fvp))
|
||||||
{
|
{
|
||||||
foundCoupledPatch = true;
|
foundCoupledPatch = true;
|
||||||
break;
|
break;
|
||||||
@ -82,7 +82,7 @@ void pyrolysisModel::constructMeshObjects()
|
|||||||
{
|
{
|
||||||
WarningIn("void pyrolysisModels::constructMeshObjects()")
|
WarningIn("void pyrolysisModels::constructMeshObjects()")
|
||||||
<< "filmCoupled flag set to true, but no "
|
<< "filmCoupled flag set to true, but no "
|
||||||
<< directMappedFieldFvPatchField<scalar>::typeName
|
<< mappedFieldFvPatchField<scalar>::typeName
|
||||||
<< " patches found on " << filmDelta.name() << " field"
|
<< " patches found on " << filmDelta.name() << " field"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user