mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote branch 'OpenCFD/master' into olesenm
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
#+DATE: TBA
|
||||
#+LINK: http://www.openfoam.com
|
||||
#+OPTIONS: author:nil ^:{}
|
||||
# Copyright (c) 2010 OpenCFD Ltd.
|
||||
# Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
* Overview
|
||||
OpenFOAM-dev is the latest major release of OpenFOAM including many new
|
||||
@ -117,7 +117,7 @@
|
||||
*** *New* compact binary I/O for faces and cells. This speeds up reading/writing meshes in binary.
|
||||
*** *Updated* runTimeModifiable
|
||||
+ user selectable model to use for checking run-time modifiable
|
||||
dictionaries:
|
||||
dictionaries (see also doc/changes/inotify.txt):
|
||||
+ timeStamp : use time stamp as before
|
||||
+ inotify : use inotify instead of time stamp
|
||||
+ timeStampMaster : only master checks and reads file. Slaves get file
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,133 +50,71 @@ int main(int argc, char *argv[])
|
||||
|
||||
const globalMeshData& globalData = mesh.globalData();
|
||||
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
|
||||
const globalIndexAndTransform& transforms = globalData.globalTransforms();
|
||||
|
||||
|
||||
// Test:print (collocated) shared points
|
||||
// Test:print shared points
|
||||
{
|
||||
const labelListList& globalPointSlaves =
|
||||
globalData.globalPointSlaves();
|
||||
const mapDistribute& globalPointSlavesMap =
|
||||
globalData.globalPointSlavesMap();
|
||||
const labelListList& slaves =
|
||||
globalData.globalPointSlaves();
|
||||
const labelListList& transformedSlaves =
|
||||
globalData.globalPointTransformedSlaves();
|
||||
|
||||
// Create field with my local data
|
||||
pointField coords(globalPointSlavesMap.constructSize());
|
||||
SubList<point>(coords, coupledPatch.nPoints()).assign
|
||||
(
|
||||
coupledPatch.localPoints()
|
||||
);
|
||||
|
||||
// Exchange data
|
||||
globalPointSlavesMap.distribute(coords);
|
||||
// Exchange data. Apply positional transforms.
|
||||
globalPointSlavesMap.distribute(transforms, coords, true);
|
||||
|
||||
// Print
|
||||
forAll(globalPointSlaves, pointI)
|
||||
forAll(slaves, pointI)
|
||||
{
|
||||
const labelList& slavePoints = globalPointSlaves[pointI];
|
||||
const labelList& slavePoints = slaves[pointI];
|
||||
|
||||
if (slavePoints.size() > 0)
|
||||
{
|
||||
Pout<< "Master point:" << pointI
|
||||
<< " coord:" << coords[pointI]
|
||||
<< " connected to slave points:" << endl;
|
||||
<< " connected to untransformed slave points:" << endl;
|
||||
|
||||
forAll(slavePoints, i)
|
||||
{
|
||||
Pout<< " " << coords[slavePoints[i]] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const labelList& transformedSlavePoints = transformedSlaves[pointI];
|
||||
|
||||
|
||||
// Test: (collocated) point to faces addressing
|
||||
{
|
||||
const labelListList& globalPointBoundaryFaces =
|
||||
globalData.globalPointBoundaryFaces();
|
||||
const mapDistribute& globalPointBoundaryFacesMap =
|
||||
globalData.globalPointBoundaryFacesMap();
|
||||
|
||||
label nBnd = mesh.nFaces()-mesh.nInternalFaces();
|
||||
|
||||
pointField fc(globalPointBoundaryFacesMap.constructSize());
|
||||
SubList<point>(fc, nBnd).assign
|
||||
(
|
||||
primitivePatch
|
||||
(
|
||||
SubList<face>
|
||||
(
|
||||
mesh.faces(),
|
||||
nBnd,
|
||||
mesh.nInternalFaces()
|
||||
),
|
||||
mesh.points()
|
||||
).faceCentres()
|
||||
);
|
||||
|
||||
// Exchange data
|
||||
globalPointBoundaryFacesMap.distribute(fc);
|
||||
|
||||
// Print
|
||||
forAll(globalPointBoundaryFaces, pointI)
|
||||
{
|
||||
const labelList& bFaces = globalPointBoundaryFaces[pointI];
|
||||
|
||||
Pout<< "Point:" << pointI
|
||||
<< " at:" << coupledPatch.localPoints()[pointI]
|
||||
<< " connected to faces:" << endl;
|
||||
|
||||
forAll(bFaces, i)
|
||||
if (transformedSlavePoints.size() > 0)
|
||||
{
|
||||
Pout<< " " << fc[bFaces[i]] << endl;
|
||||
Pout<< "Master point:" << pointI
|
||||
<< " coord:" << coords[pointI]
|
||||
<< " connected to transformed slave points:" << endl;
|
||||
|
||||
forAll(transformedSlavePoints, i)
|
||||
{
|
||||
Pout<< " " << coords[transformedSlavePoints[i]]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Test:(collocated) point to cells addressing
|
||||
// Test:print shared edges
|
||||
{
|
||||
const labelList& boundaryCells = globalData.boundaryCells();
|
||||
const labelListList& globalPointBoundaryCells =
|
||||
globalData.globalPointBoundaryCells();
|
||||
const mapDistribute& globalPointBoundaryCellsMap =
|
||||
globalData.globalPointBoundaryCellsMap();
|
||||
|
||||
pointField cc(globalPointBoundaryCellsMap.constructSize());
|
||||
forAll(boundaryCells, i)
|
||||
{
|
||||
cc[i] = mesh.cellCentres()[boundaryCells[i]];
|
||||
}
|
||||
|
||||
// Exchange data
|
||||
globalPointBoundaryCellsMap.distribute(cc);
|
||||
|
||||
// Print
|
||||
forAll(globalPointBoundaryCells, pointI)
|
||||
{
|
||||
const labelList& bCells = globalPointBoundaryCells[pointI];
|
||||
|
||||
Pout<< "Point:" << pointI
|
||||
<< " at:" << coupledPatch.localPoints()[pointI]
|
||||
<< " connected to cells:" << endl;
|
||||
|
||||
forAll(bCells, i)
|
||||
{
|
||||
Pout<< " " << cc[bCells[i]] << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Test:print (collocated) shared edges
|
||||
{
|
||||
const labelListList& globalEdgeSlaves =
|
||||
globalData.globalEdgeSlaves();
|
||||
const mapDistribute& globalEdgeSlavesMap =
|
||||
globalData.globalEdgeSlavesMap();
|
||||
const labelListList& slaves =
|
||||
globalData.globalEdgeSlaves();
|
||||
const labelListList& transformedSlaves =
|
||||
globalData.globalEdgeTransformedSlaves();
|
||||
|
||||
// Test: distribute edge centres
|
||||
pointField ec(globalEdgeSlavesMap.constructSize());
|
||||
@ -188,13 +126,13 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
// Exchange data
|
||||
globalEdgeSlavesMap.distribute(ec);
|
||||
// Exchange data Apply positional transforms.
|
||||
globalEdgeSlavesMap.distribute(transforms, ec, true);
|
||||
|
||||
// Print
|
||||
forAll(globalEdgeSlaves, edgeI)
|
||||
forAll(slaves, edgeI)
|
||||
{
|
||||
const labelList& slaveEdges = globalEdgeSlaves[edgeI];
|
||||
const labelList& slaveEdges = slaves[edgeI];
|
||||
|
||||
if (slaveEdges.size() > 0)
|
||||
{
|
||||
@ -207,10 +145,102 @@ int main(int argc, char *argv[])
|
||||
Pout<< " " << ec[slaveEdges[i]] << endl;
|
||||
}
|
||||
}
|
||||
const labelList& transformedSlaveEdges = transformedSlaves[edgeI];
|
||||
|
||||
if (transformedSlaveEdges.size() > 0)
|
||||
{
|
||||
Pout<< "Master edge:" << edgeI
|
||||
<< " centre:" << ec[edgeI]
|
||||
<< " connected to transformed slave edges:" << endl;
|
||||
|
||||
forAll(transformedSlaveEdges, i)
|
||||
{
|
||||
Pout<< " " << ec[transformedSlaveEdges[i]]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// Test: (collocated) point to faces addressing
|
||||
//{
|
||||
// const labelListList& globalPointBoundaryFaces =
|
||||
// globalData.globalPointBoundaryFaces();
|
||||
// const mapDistribute& globalPointBoundaryFacesMap =
|
||||
// globalData.globalPointBoundaryFacesMap();
|
||||
//
|
||||
// label nBnd = mesh.nFaces()-mesh.nInternalFaces();
|
||||
//
|
||||
// pointField fc(globalPointBoundaryFacesMap.constructSize());
|
||||
// SubList<point>(fc, nBnd).assign
|
||||
// (
|
||||
// primitivePatch
|
||||
// (
|
||||
// SubList<face>
|
||||
// (
|
||||
// mesh.faces(),
|
||||
// nBnd,
|
||||
// mesh.nInternalFaces()
|
||||
// ),
|
||||
// mesh.points()
|
||||
// ).faceCentres()
|
||||
// );
|
||||
//
|
||||
// // Exchange data
|
||||
// globalPointBoundaryFacesMap.distribute(fc);
|
||||
//
|
||||
// // Print
|
||||
// forAll(globalPointBoundaryFaces, pointI)
|
||||
// {
|
||||
// const labelList& bFaces = globalPointBoundaryFaces[pointI];
|
||||
//
|
||||
// Pout<< "Point:" << pointI
|
||||
// << " at:" << coupledPatch.localPoints()[pointI]
|
||||
// << " connected to faces:" << endl;
|
||||
//
|
||||
// forAll(bFaces, i)
|
||||
// {
|
||||
// Pout<< " " << fc[bFaces[i]] << endl;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//
|
||||
//// Test:(collocated) point to cells addressing
|
||||
//{
|
||||
// const labelList& boundaryCells = globalData.boundaryCells();
|
||||
// const labelListList& globalPointBoundaryCells =
|
||||
// globalData.globalPointBoundaryCells();
|
||||
// const mapDistribute& globalPointBoundaryCellsMap =
|
||||
// globalData.globalPointBoundaryCellsMap();
|
||||
//
|
||||
// pointField cc(globalPointBoundaryCellsMap.constructSize());
|
||||
// forAll(boundaryCells, i)
|
||||
// {
|
||||
// cc[i] = mesh.cellCentres()[boundaryCells[i]];
|
||||
// }
|
||||
//
|
||||
// // Exchange data
|
||||
// globalPointBoundaryCellsMap.distribute(cc);
|
||||
//
|
||||
// // Print
|
||||
// forAll(globalPointBoundaryCells, pointI)
|
||||
// {
|
||||
// const labelList& bCells = globalPointBoundaryCells[pointI];
|
||||
//
|
||||
// Pout<< "Point:" << pointI
|
||||
// << " at:" << coupledPatch.localPoints()[pointI]
|
||||
// << " connected to cells:" << endl;
|
||||
//
|
||||
// forAll(bCells, i)
|
||||
// {
|
||||
// Pout<< " " << cc[bCells[i]] << endl;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-lduMatrix3.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-lduMatrix
|
||||
@ -1,4 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = -lfiniteVolume
|
||||
@ -1,163 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "LduMatrix.H"
|
||||
#include "diagTensorField.H"
|
||||
#include "TPCG.H"
|
||||
#include "TPBiCG.H"
|
||||
#include "NoPreconditioner.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
typedef Foam::LduMatrix<vector, diagTensor, scalar>
|
||||
lduVectorMatrix;
|
||||
defineNamedTemplateTypeNameAndDebug(lduVectorMatrix, 0);
|
||||
|
||||
typedef Foam::DiagonalSolver<vector, diagTensor, scalar>
|
||||
lduVectorDiagonalSolver;
|
||||
defineNamedTemplateTypeNameAndDebug(lduVectorDiagonalSolver, 0);
|
||||
|
||||
template<>
|
||||
const vector lduVectorMatrix::great_(1e15, 1e15, 1e15);
|
||||
|
||||
template<>
|
||||
const vector lduVectorMatrix::small_(1e-15, 1e-15, 1e-15);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef LduMatrix<vector, diagTensor, scalar>::preconditioner
|
||||
lduVectorPreconditioner;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, asymMatrix);
|
||||
|
||||
typedef LduMatrix<vector, diagTensor, scalar>::smoother
|
||||
lduVectorSmoother;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSmoother, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSmoother, asymMatrix);
|
||||
|
||||
typedef LduMatrix<vector, diagTensor, scalar>::solver
|
||||
lduVectorSolver;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSolver, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSolver, asymMatrix);
|
||||
|
||||
typedef TPCG<vector, diagTensor, scalar> TPCGVector;
|
||||
defineNamedTemplateTypeNameAndDebug(TPCGVector, 0);
|
||||
|
||||
LduMatrix<vector, diagTensor, scalar>::solver::
|
||||
addsymMatrixConstructorToTable<TPCGVector>
|
||||
addTPCGSymMatrixConstructorToTable_;
|
||||
|
||||
typedef TPBiCG<vector, diagTensor, scalar> TPBiCGVector;
|
||||
defineNamedTemplateTypeNameAndDebug(TPBiCGVector, 0);
|
||||
|
||||
LduMatrix<vector, diagTensor, scalar>::solver::
|
||||
addasymMatrixConstructorToTable<TPBiCGVector>
|
||||
addTPBiCGSymMatrixConstructorToTable_;
|
||||
|
||||
typedef NoPreconditioner<vector, diagTensor, scalar> NoPreconditionerVector;
|
||||
defineNamedTemplateTypeNameAndDebug(NoPreconditionerVector, 0);
|
||||
|
||||
LduMatrix<vector, diagTensor, scalar>::preconditioner::
|
||||
addsymMatrixConstructorToTable<NoPreconditionerVector>
|
||||
addNoPreconditionerSymMatrixConstructorToTable_;
|
||||
|
||||
LduMatrix<vector, diagTensor, scalar>::preconditioner::
|
||||
addasymMatrixConstructorToTable<NoPreconditionerVector>
|
||||
addNoPreconditionerAsymMatrixConstructorToTable_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
volVectorField psi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
lduVectorMatrix testMatrix(mesh);
|
||||
testMatrix.diag() = 2*pTraits<diagTensor>::one;
|
||||
testMatrix.source() = pTraits<vector>::one;
|
||||
testMatrix.upper() = 0.1;
|
||||
testMatrix.lower() = -0.1;
|
||||
|
||||
Info<< testMatrix << endl;
|
||||
|
||||
FieldField<Field, scalar> boundaryCoeffs(0);
|
||||
FieldField<Field, scalar> internalCoeffs(0);
|
||||
|
||||
autoPtr<lduVectorMatrix::solver> testMatrixSolver =
|
||||
lduVectorMatrix::solver::New
|
||||
(
|
||||
psi.name(),
|
||||
testMatrix,
|
||||
boundaryCoeffs,
|
||||
internalCoeffs,
|
||||
psi.boundaryField().interfaces(),
|
||||
IStringStream
|
||||
(
|
||||
"PBiCG"
|
||||
"{"
|
||||
" preconditioner none;"
|
||||
" tolerance (1e-05 1e-05 1e-05);"
|
||||
" relTol (0 0 0);"
|
||||
"}"
|
||||
)()
|
||||
);
|
||||
|
||||
lduVectorMatrix::solverPerformance solverPerf =
|
||||
testMatrixSolver->solve(psi);
|
||||
|
||||
solverPerf.print();
|
||||
|
||||
Info<< psi << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,163 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "LduMatrix.H"
|
||||
#include "tensorField.H"
|
||||
#include "TPCG.H"
|
||||
#include "TPBiCG.H"
|
||||
#include "NoPreconditioner.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
typedef Foam::LduMatrix<vector, tensor, scalar>
|
||||
lduVectorMatrix;
|
||||
defineNamedTemplateTypeNameAndDebug(lduVectorMatrix, 0);
|
||||
|
||||
typedef Foam::DiagonalSolver<vector, tensor, scalar>
|
||||
lduVectorDiagonalSolver;
|
||||
defineNamedTemplateTypeNameAndDebug(lduVectorDiagonalSolver, 0);
|
||||
|
||||
template<>
|
||||
const vector lduVectorMatrix::great_(1e15, 1e15, 1e15);
|
||||
|
||||
template<>
|
||||
const vector lduVectorMatrix::small_(1e-15, 1e-15, 1e-15);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef LduMatrix<vector, tensor, scalar>::preconditioner
|
||||
lduVectorPreconditioner;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorPreconditioner, asymMatrix);
|
||||
|
||||
typedef LduMatrix<vector, tensor, scalar>::smoother
|
||||
lduVectorSmoother;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSmoother, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSmoother, asymMatrix);
|
||||
|
||||
typedef LduMatrix<vector, tensor, scalar>::solver
|
||||
lduVectorSolver;
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSolver, symMatrix);
|
||||
defineTemplateRunTimeSelectionTable(lduVectorSolver, asymMatrix);
|
||||
|
||||
typedef TPCG<vector, tensor, scalar> TPCGVector;
|
||||
defineNamedTemplateTypeNameAndDebug(TPCGVector, 0);
|
||||
|
||||
LduMatrix<vector, tensor, scalar>::solver::
|
||||
addsymMatrixConstructorToTable<TPCGVector>
|
||||
addTPCGSymMatrixConstructorToTable_;
|
||||
|
||||
typedef TPBiCG<vector, tensor, scalar> TPBiCGVector;
|
||||
defineNamedTemplateTypeNameAndDebug(TPBiCGVector, 0);
|
||||
|
||||
LduMatrix<vector, tensor, scalar>::solver::
|
||||
addasymMatrixConstructorToTable<TPBiCGVector>
|
||||
addTPBiCGSymMatrixConstructorToTable_;
|
||||
|
||||
typedef NoPreconditioner<vector, tensor, scalar> NoPreconditionerVector;
|
||||
defineNamedTemplateTypeNameAndDebug(NoPreconditionerVector, 0);
|
||||
|
||||
LduMatrix<vector, tensor, scalar>::preconditioner::
|
||||
addsymMatrixConstructorToTable<NoPreconditionerVector>
|
||||
addNoPreconditionerSymMatrixConstructorToTable_;
|
||||
|
||||
LduMatrix<vector, tensor, scalar>::preconditioner::
|
||||
addasymMatrixConstructorToTable<NoPreconditionerVector>
|
||||
addNoPreconditionerAsymMatrixConstructorToTable_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
volVectorField psi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
lduVectorMatrix testMatrix(mesh);
|
||||
testMatrix.diag() = 2*I;
|
||||
testMatrix.source() = pTraits<vector>::one;
|
||||
testMatrix.upper() = 0.1;
|
||||
testMatrix.lower() = -0.1;
|
||||
|
||||
Info<< testMatrix << endl;
|
||||
|
||||
FieldField<Field, scalar> boundaryCoeffs(0);
|
||||
FieldField<Field, scalar> internalCoeffs(0);
|
||||
|
||||
autoPtr<lduVectorMatrix::solver> testMatrixSolver =
|
||||
lduVectorMatrix::solver::New
|
||||
(
|
||||
psi.name(),
|
||||
testMatrix,
|
||||
//boundaryCoeffs,
|
||||
//internalCoeffs,
|
||||
//psi.boundaryField().interfaces(),
|
||||
IStringStream
|
||||
(
|
||||
"PBiCG"
|
||||
"{"
|
||||
" preconditioner none;"
|
||||
" tolerance (1e-05 1e-05 1e-05);"
|
||||
" relTol (0 0 0);"
|
||||
"}"
|
||||
)()
|
||||
);
|
||||
|
||||
lduVectorMatrix::solverPerformance solverPerf =
|
||||
testMatrixSolver->solve(psi);
|
||||
|
||||
solverPerf.print();
|
||||
|
||||
Info<< psi << endl;
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,148 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
icoFoam
|
||||
|
||||
Description
|
||||
Transient solver for incompressible, laminar flow of Newtonian fluids.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "LduMatrix.H"
|
||||
#include "diagTensorField.H"
|
||||
|
||||
typedef LduMatrix<vector, scalar, scalar> lduVectorMatrix;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readPISOControls.H"
|
||||
# include "CourantNo.H"
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(nu, U)
|
||||
);
|
||||
|
||||
fvVectorMatrix UEqnp(UEqn == -fvc::grad(p));
|
||||
|
||||
lduVectorMatrix U3Eqnp(mesh);
|
||||
U3Eqnp.diag() = UEqnp.diag();
|
||||
U3Eqnp.upper() = UEqnp.upper();
|
||||
U3Eqnp.lower() = UEqnp.lower();
|
||||
U3Eqnp.source() = UEqnp.source();
|
||||
|
||||
UEqnp.addBoundaryDiag(U3Eqnp.diag(), 0);
|
||||
UEqnp.addBoundarySource(U3Eqnp.source(), false);
|
||||
|
||||
autoPtr<lduVectorMatrix::solver> U3EqnpSolver =
|
||||
lduVectorMatrix::solver::New
|
||||
(
|
||||
U.name(),
|
||||
U3Eqnp,
|
||||
dictionary
|
||||
(
|
||||
IStringStream
|
||||
(
|
||||
"{"
|
||||
" solver PBiCG;"
|
||||
" preconditioner DILU;"
|
||||
" tolerance (1e-13 1e-13 1e-13);"
|
||||
" relTol (0 0 0);"
|
||||
"}"
|
||||
)()
|
||||
)
|
||||
);
|
||||
|
||||
U3EqnpSolver->solve(U).print(Info);
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
|
||||
U = rAU*UEqn.H();
|
||||
phi = (fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rAU, U, phi);
|
||||
|
||||
adjustPhi(phi, U, p);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rAU, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
# include "continuityErrs.H"
|
||||
|
||||
U -= rAU*fvc::grad(p);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,56 +0,0 @@
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar nu
|
||||
(
|
||||
transportProperties.lookup("nu")
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
|
||||
# include "createPhi.H"
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -129,7 +129,7 @@ int main(int argc, char *argv[])
|
||||
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
||||
|
||||
// Distribute complexData
|
||||
mapDistribute::distribute(complexData);
|
||||
map.distribute(complexData);
|
||||
|
||||
Pout<< "complexData:" << complexData << endl;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -522,7 +522,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
|
||||
const boundBox& bb = mesh.globalData().bb();
|
||||
const boundBox& bb = mesh.bounds();
|
||||
const vector span = bb.span();
|
||||
const scalar mergeDim = 1E-4 * bb.minDim();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,7 +44,8 @@ inline bool writeMeshObject
|
||||
(
|
||||
const word& name,
|
||||
const fileName& meshDir,
|
||||
Time& runTime
|
||||
Time& runTime,
|
||||
bool disableHeaderChecking = false
|
||||
)
|
||||
{
|
||||
IOobject io
|
||||
@ -67,14 +68,21 @@ inline bool writeMeshObject
|
||||
|
||||
// Switch off type checking (for reading e.g. faceZones as
|
||||
// generic list of dictionaries).
|
||||
const word oldTypeName = T::typeName;
|
||||
const_cast<word&>(T::typeName) = word::null;
|
||||
word oldTypeName;
|
||||
if (disableHeaderChecking)
|
||||
{
|
||||
oldTypeName = T::typeName;
|
||||
const_cast<word&>(T::typeName) = word::null;
|
||||
}
|
||||
|
||||
T meshObject(io);
|
||||
|
||||
const_cast<word&>(T::typeName) = oldTypeName;
|
||||
// Fake type back to what was in field
|
||||
const_cast<word&>(meshObject.type()) = io.headerClassName();
|
||||
if (disableHeaderChecking)
|
||||
{
|
||||
const_cast<word&>(T::typeName) = oldTypeName;
|
||||
// Fake type back to what was in field
|
||||
const_cast<word&>(meshObject.type()) = io.headerClassName();
|
||||
}
|
||||
|
||||
Info<< " Writing " << name << endl;
|
||||
writeOk = meshObject.regIOobject::write();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -910,7 +910,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
args,
|
||||
runTime,
|
||||
mesh.globalData().bb()
|
||||
mesh.bounds()
|
||||
);
|
||||
|
||||
// Mesh distribution engine
|
||||
|
||||
@ -231,6 +231,7 @@ surfaces
|
||||
// Sampling on triSurface
|
||||
type sampledTriSurfaceMesh;
|
||||
surface integrationPlane.stl;
|
||||
source boundaryFaces; // sample cells or boundaryFaces
|
||||
interpolate true;
|
||||
}
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -208,7 +208,7 @@ int main(int argc, char *argv[])
|
||||
const scalar searchTol = args.optionLookupOrDefault("tol", 1e-3);
|
||||
|
||||
// Get search box. Anything not within this box will not be considered.
|
||||
const boundBox& meshBb = mesh.globalData().bb();
|
||||
const boundBox& meshBb = mesh.bounds();
|
||||
const vector searchSpan = searchTol * meshBb.span();
|
||||
|
||||
Info<< "All boundary faces further away than " << searchTol
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -145,12 +145,12 @@ fi
|
||||
# use FOAM_SETTINGS to pass command-line settings
|
||||
if [ "$FOAM_INST_DIR" ]
|
||||
then
|
||||
sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam $FOAM_SETTINGS"
|
||||
sourceFoam="FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam $FOAM_SETTINGS"
|
||||
else
|
||||
sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam $FOAM_SETTINGS"
|
||||
sourceFoam=". $sourceFoam $FOAM_SETTINGS"
|
||||
fi
|
||||
|
||||
echo "**sourceFoam:$sourceFoam $FOAM_SETTINGS"
|
||||
echo "**sourceFoam:$sourceFoam"
|
||||
|
||||
rm -f $PWD/mpirun.schema
|
||||
touch $PWD/mpirun.schema
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
2010-05-28
|
||||
http://www.openfoam.com
|
||||
Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
Cleanup of automatic regIOobject rereading.
|
||||
|
||||
- all files (usually only IOdictionary) that need to be monitored
|
||||
|
||||
41
doc/changes/pointAndEdgeSync.txt
Normal file
41
doc/changes/pointAndEdgeSync.txt
Normal file
@ -0,0 +1,41 @@
|
||||
http://www.openfoam.com
|
||||
Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
Some background on the new structure to synchronise point and edge data. The
|
||||
building blocks:
|
||||
- globalIndex : globally consecutive numbering of (untransformed) data. It
|
||||
consists of a single label which starts at 0 on processor 0 and is numbered
|
||||
consecutively on consecutive processors. The globalIndex class contains
|
||||
functions to convert to/from processor and local index.
|
||||
|
||||
- globalIndexAndTransform : all the transformations in a mesh. Because the
|
||||
transformations (cyclics, processorCyclics) need to fill space there can
|
||||
be only three independent transforms. This class contains functions to encode
|
||||
local index,processor and transformation into a labelPair.
|
||||
|
||||
- mapDistribute : contains constructors from local and remote data and
|
||||
works out a compact storage scheme and returns corresponding indices into
|
||||
the local storage and calculates a scheduling to get the local and remote
|
||||
data into the local storage. The wanted data is
|
||||
- untransformed: labelList(List) in globalIndex numbering
|
||||
- transformed: labelPairList(List) in globalIndexAndTransform
|
||||
See also mapDistribute.H
|
||||
|
||||
- globalMeshData : works out and stores a mapDistribute to get hold
|
||||
of coupled point or edge data:
|
||||
- globalPointSlavesMap() : the map to get all coupled point data
|
||||
into a compact form
|
||||
- globalPointSlaves : per point (on the patch of coupled faces) the
|
||||
indices into the compact data corresponding to untransformed connected
|
||||
points
|
||||
- globalPointTransformedSlaves : same but for transformed connected
|
||||
points
|
||||
See e.g. syncPointData which applies a reduction operator to data on
|
||||
coupled points. Note that it needs to know whether the data is a position
|
||||
(since might need separation() vector).
|
||||
|
||||
These structures get used in e.g.
|
||||
- syncTools : general synchronisation on points,edges, faces. The point and
|
||||
edge synchronisation are thin wrappers around the globalMeshData functionality.
|
||||
- volPointInterpolation : uses a mix of globalMeshData (for synchronising
|
||||
collocated points) and patch-wise (for separated points).
|
||||
@ -1,3 +1,6 @@
|
||||
http://www.openfoam.com
|
||||
Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
Short overview of the changes to have cyclics split into two halves.
|
||||
|
||||
Cyclics
|
||||
|
||||
@ -42,6 +42,8 @@ primitives/SphericalTensor2D/sphericalTensor2D/sphericalTensor2D.C
|
||||
primitives/Vector2D/vector2D/vector2D.C
|
||||
|
||||
primitives/complex/complex.C
|
||||
primitives/globalIndexAndTransform/globalIndexAndTransform.C
|
||||
primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
|
||||
primitives/quaternion/quaternion.C
|
||||
primitives/septernion/septernion.C
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,52 +32,56 @@ Description
|
||||
- all processor patches to have correct ordering.
|
||||
- all processorPatches to have their transforms set.
|
||||
|
||||
The shared point addressing is quite interesting. It gives on each processor
|
||||
the vertices that cannot be set using a normal swap on processor patches.
|
||||
These are the vertices that are shared between more than 2 processors.
|
||||
The shared point and edge addressing is quite interesting.
|
||||
It calculates addressing for points and edges on coupled patches. In
|
||||
the 'old' way a distincation was made between points/edges that are
|
||||
only on two processors and those that are on multiple processors. The
|
||||
problem is that those on multiple processors do not allow any
|
||||
transformations and require a global reduction on the master processor.
|
||||
|
||||
There is an issue with these shared vertices if they originate from
|
||||
cyclics (i.e. are now separated processor patches). They will all be
|
||||
mapped to the same global point (so even though the processor points are
|
||||
not on the same location) since topologically they are one and the same.
|
||||
The alternative is to have an exchange schedule (through a 'mapDistribute')
|
||||
which sends all point/edge data (no distinction is made between
|
||||
those on two and those on more than two coupled patches) to the local
|
||||
'master'. This master then does any calculation and sends
|
||||
the result back to the 'slave' points/edges. This only needs to be done
|
||||
on points on coupled faces. Any transformation is done using a predetermined
|
||||
set of transformations - since transformations have to be space filling
|
||||
only a certain number of transformation is supported.
|
||||
|
||||
So if you ask for sharedPoints() you get only one of the coordinates of
|
||||
the topologically shared points.
|
||||
The exchange needs
|
||||
- a field of data
|
||||
- a mapDistribute which does all parallel exchange and transformations
|
||||
This appens remote data to the end of the field.
|
||||
- a set of indices which indicate where to get untransformed data in the
|
||||
field
|
||||
- a set of indices which indicate where to get transformed data in the
|
||||
field
|
||||
|
||||
All the hard work of these shared points is done by the globalPoints class.
|
||||
See also mapDistribute, globalIndexAndTransform
|
||||
|
||||
Shared edges: similar to shared points gives on all processors the edges
|
||||
that are shared between more than two patches (i.e. the edges on which
|
||||
data cannot be synchronized by a straightforward edge data swap). Note
|
||||
that shared edges will use shared points but not all edges between shared
|
||||
points need to be shared edges (e.g. there might be an edge connecting
|
||||
two disconnected regions of shared points).
|
||||
|
||||
Currently an edge is considered shared
|
||||
Notes:
|
||||
- compared to 17x nTotalFaces, nTotalPoints do not compensate for
|
||||
shared points since this would trigger full connectivity analysis
|
||||
- most calculation is demand driven and uses parallel communication
|
||||
so make sure to invoke on all processors at the same time.
|
||||
- old sharedEdge calculation: currently an edge is considered shared
|
||||
if it uses two shared points and is used more than once. This is not
|
||||
correct on processor patches but it only slightly overestimates the number
|
||||
of shared edges. Doing full analysis of how many patches use the edge
|
||||
would be too complicated.
|
||||
|
||||
Shared edge calculation is demand driven so always make sure to have
|
||||
your first call to one of the access functions synchronous amongst all
|
||||
processors!
|
||||
|
||||
|
||||
SourceFiles
|
||||
globalMeshData.C
|
||||
globalMeshDataTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef globalMeshData_H
|
||||
#define globalMeshData_H
|
||||
|
||||
#include "Switch.H"
|
||||
#include "processorTopology.H"
|
||||
#include "labelPair.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "boundBox.H"
|
||||
#include "IOobject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -86,13 +90,11 @@ namespace Foam
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class globalMeshData;
|
||||
Ostream& operator<<(Ostream&, const globalMeshData&);
|
||||
class globalIndex;
|
||||
class polyMesh;
|
||||
class mapDistribute;
|
||||
template<class T> class EdgeMap;
|
||||
class globalPoints;
|
||||
class globalIndex;
|
||||
class globalIndexAndTransform;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class globalMeshData Declaration
|
||||
@ -126,9 +128,6 @@ class globalMeshData
|
||||
};
|
||||
|
||||
|
||||
typedef List<labelPair> labelPairList;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
@ -137,9 +136,6 @@ class globalMeshData
|
||||
|
||||
// Data related to the complete mesh
|
||||
|
||||
//- Bounding box of complete mesh
|
||||
boundBox bb_;
|
||||
|
||||
//- Total number of points in the complete mesh
|
||||
label nTotalPoints_;
|
||||
|
||||
@ -165,23 +161,70 @@ class globalMeshData
|
||||
labelList processorPatchNeighbours_;
|
||||
|
||||
|
||||
// Coupled point addressing
|
||||
// This is addressing from coupled point to coupled points/faces/cells.
|
||||
// This is a full schedule so includes points used by only two
|
||||
// coupled patches.
|
||||
|
||||
//- Patch of coupled faces. Additional patch edge to mesh edges
|
||||
// correspondence:
|
||||
// points: meshPoints(), meshPointMap()
|
||||
// edges : meshEdges(), meshEdgeMap()
|
||||
mutable autoPtr<indirectPrimitivePatch> coupledPatchPtr_;
|
||||
mutable autoPtr<labelList> coupledPatchMeshEdgesPtr_;
|
||||
mutable autoPtr<Map<label> > coupledPatchMeshEdgeMapPtr_;
|
||||
|
||||
//- Global numbering for coupledPatch points
|
||||
mutable autoPtr<globalIndex> globalPointNumberingPtr_;
|
||||
|
||||
//- Global numbering for transforms
|
||||
mutable autoPtr<globalIndexAndTransform> globalTransformsPtr_;
|
||||
|
||||
// Coupled point to coupled points
|
||||
|
||||
mutable autoPtr<labelListList> globalPointSlavesPtr_;
|
||||
mutable autoPtr<labelListList> globalPointTransformedSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointSlavesMapPtr_;
|
||||
|
||||
// Coupled edge to coupled edges
|
||||
|
||||
mutable autoPtr<globalIndex> globalEdgeNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalEdgeSlavesPtr_;
|
||||
mutable autoPtr<labelListList> globalEdgeTransformedSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
|
||||
|
||||
|
||||
//// Coupled point to boundary faces
|
||||
//
|
||||
//mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
|
||||
//mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
|
||||
//mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
||||
//
|
||||
//// Coupled point to collocated boundary cells
|
||||
//
|
||||
//mutable autoPtr<labelList> boundaryCellsPtr_;
|
||||
//mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
||||
//mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_;
|
||||
//mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
|
||||
|
||||
|
||||
// Globally shared point addressing
|
||||
|
||||
//- Total number of global points
|
||||
label nGlobalPoints_;
|
||||
mutable label nGlobalPoints_;
|
||||
|
||||
//- Indices of local points that are globally shared
|
||||
labelList sharedPointLabels_;
|
||||
mutable autoPtr<labelList> sharedPointLabelsPtr_;
|
||||
|
||||
//- Indices of globally shared points in the master list
|
||||
// This list contains all the shared points in the mesh
|
||||
labelList sharedPointAddr_;
|
||||
mutable autoPtr<labelList> sharedPointAddrPtr_;
|
||||
|
||||
//- Shared point global labels.
|
||||
// Global point index for every local shared point.
|
||||
// Only valid if constructed with this information or if
|
||||
// pointProcAddressing read.
|
||||
mutable labelList* sharedPointGlobalLabelsPtr_;
|
||||
mutable autoPtr<labelList> sharedPointGlobalLabelsPtr_;
|
||||
|
||||
|
||||
// Globally shared edge addressing. Derived from shared points.
|
||||
@ -191,68 +234,11 @@ class globalMeshData
|
||||
mutable label nGlobalEdges_;
|
||||
|
||||
//- Indices of local edges that are globally shared
|
||||
mutable labelList* sharedEdgeLabelsPtr_;
|
||||
mutable autoPtr<labelList> sharedEdgeLabelsPtr_;
|
||||
|
||||
//- Indices of globally shared edge in the master list
|
||||
// This list contains all the shared edges in the mesh
|
||||
mutable labelList* sharedEdgeAddrPtr_;
|
||||
|
||||
|
||||
// Coupled point addressing
|
||||
// This is addressing from coupled point to coupled points/faces/cells.
|
||||
// Two variants:
|
||||
// - collocated (so not physically separated)
|
||||
// - also separated
|
||||
// This is a full schedule so includes points only used by two
|
||||
// coupled patches.
|
||||
|
||||
mutable autoPtr<indirectPrimitivePatch> coupledPatchPtr_;
|
||||
|
||||
mutable autoPtr<labelList> coupledPatchMeshEdgesPtr_;
|
||||
|
||||
mutable autoPtr<Map<label> > coupledPatchMeshEdgeMapPtr_;
|
||||
|
||||
// Collocated
|
||||
|
||||
// Coupled point to collocated coupled points
|
||||
|
||||
mutable autoPtr<globalIndex> globalPointNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointSlavesMapPtr_;
|
||||
|
||||
// Coupled edge to collocated coupled edges
|
||||
|
||||
mutable autoPtr<globalIndex> globalEdgeNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalEdgeSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
|
||||
|
||||
// Coupled point to collocated boundary faces
|
||||
|
||||
mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
||||
|
||||
// Coupled point to collocated boundary cells
|
||||
|
||||
mutable autoPtr<labelList> boundaryCellsPtr_;
|
||||
mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointBoundaryCellsPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
|
||||
|
||||
|
||||
// Non-collocated as well
|
||||
|
||||
// Coupled point to all coupled points
|
||||
|
||||
mutable autoPtr<globalIndex> globalPointAllNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointAllSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointAllSlavesMapPtr_;
|
||||
|
||||
// Coupled edge to all coupled edges (same numbering as
|
||||
// collocated coupled edges)
|
||||
|
||||
mutable autoPtr<labelListList> globalEdgeAllSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalEdgeAllSlavesMapPtr_;
|
||||
mutable autoPtr<labelList> sharedEdgeAddrPtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -268,70 +254,18 @@ class globalMeshData
|
||||
label&
|
||||
);
|
||||
|
||||
//- Calculate shared point addressing
|
||||
void calcSharedPoints() const;
|
||||
|
||||
//- Calculate shared edge addressing
|
||||
void calcSharedEdges() const;
|
||||
|
||||
//- Count coincident faces.
|
||||
static label countCoincidentFaces
|
||||
(
|
||||
const scalar tolDim,
|
||||
const vectorField& separationDist
|
||||
);
|
||||
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointSlaves
|
||||
(
|
||||
const globalPoints&,
|
||||
autoPtr<globalIndex>&,
|
||||
autoPtr<labelListList>&,
|
||||
autoPtr<mapDistribute>&
|
||||
) const;
|
||||
|
||||
//- Calculate global point addressing.
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointSlaves() const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves
|
||||
(
|
||||
const labelListList&,
|
||||
const mapDistribute&,
|
||||
const globalIndex&,
|
||||
autoPtr<labelListList>&,
|
||||
autoPtr<mapDistribute>&
|
||||
) const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves() const;
|
||||
|
||||
//- Calculate coupled point to uncoupled boundary faces. Local only.
|
||||
void calcPointBoundaryFaces(labelListList& pointBoundaryFaces) const;
|
||||
|
||||
//- Calculate global point to global boundary face addressing.
|
||||
void calcGlobalPointBoundaryFaces() const;
|
||||
|
||||
//- Calculate global point to global boundary cell addressing.
|
||||
void calcGlobalPointBoundaryCells() const;
|
||||
|
||||
|
||||
// Non-collocated
|
||||
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointAllSlaves() const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeAllSlaves() const;
|
||||
|
||||
|
||||
//- Synchronise pointwise data
|
||||
template<class Type, class CombineOp>
|
||||
void syncPointData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const labelListList& slaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const CombineOp& cop
|
||||
) const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
globalMeshData(const globalMeshData&);
|
||||
@ -348,7 +282,7 @@ public:
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Geomtric tolerance (fraction of bounding box)
|
||||
//- Geomteric tolerance (fraction of bounding box)
|
||||
static const Foam::scalar matchTol_;
|
||||
|
||||
|
||||
@ -357,10 +291,6 @@ public:
|
||||
//- Construct from mesh, derive rest (does parallel communication!)
|
||||
globalMeshData(const polyMesh& mesh);
|
||||
|
||||
//- Old behaviour: read constructor given IOobject and a polyMesh
|
||||
// reference. Only use this for testing!
|
||||
globalMeshData(const IOobject& io, const polyMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~globalMeshData();
|
||||
@ -386,24 +316,21 @@ public:
|
||||
return processorPatches_.size() > 0;
|
||||
}
|
||||
|
||||
const boundBox& bb() const
|
||||
{
|
||||
return bb_;
|
||||
}
|
||||
|
||||
//- Return total number of points in decomposed mesh
|
||||
//- Return total number of points in decomposed mesh. Not
|
||||
// compensated for duplicate points!
|
||||
label nTotalPoints() const
|
||||
{
|
||||
return nTotalPoints_;
|
||||
}
|
||||
|
||||
//- Return total number of faces in decomposed mesh
|
||||
//- Return total number of faces in decomposed mesh. Not
|
||||
// compensated for duplicate faces!
|
||||
label nTotalFaces() const
|
||||
{
|
||||
return nTotalFaces_;
|
||||
}
|
||||
|
||||
//- Return total number of cells in decomposed mesh
|
||||
//- Return total number of cells in decomposed mesh.
|
||||
label nTotalCells() const
|
||||
{
|
||||
return nTotalCells_;
|
||||
@ -438,16 +365,10 @@ public:
|
||||
// Globally shared point addressing
|
||||
|
||||
//- Return number of globally shared points
|
||||
label nGlobalPoints() const
|
||||
{
|
||||
return nGlobalPoints_;
|
||||
}
|
||||
label nGlobalPoints() const;
|
||||
|
||||
//- Return indices of local points that are globally shared
|
||||
const labelList& sharedPointLabels() const
|
||||
{
|
||||
return sharedPointLabels_;
|
||||
}
|
||||
const labelList& sharedPointLabels() const;
|
||||
|
||||
//- Return addressing into the complete globally shared points
|
||||
// list
|
||||
@ -457,10 +378,7 @@ public:
|
||||
// points. Shared point addressing gives the index in the
|
||||
// list of all globally shared points for each of the locally
|
||||
// shared points.
|
||||
const labelList& sharedPointAddr() const
|
||||
{
|
||||
return sharedPointAddr_;
|
||||
}
|
||||
const labelList& sharedPointAddr() const;
|
||||
|
||||
//- Return shared point global labels. Tries to read
|
||||
// 'pointProcAddressing' and returns list or -1 if none
|
||||
@ -515,70 +433,47 @@ public:
|
||||
//- Return map from mesh edges to coupledPatch edges
|
||||
const Map<label>& coupledPatchMeshEdgeMap() const;
|
||||
|
||||
//- Global transforms numbering
|
||||
const globalIndexAndTransform& globalTransforms() const;
|
||||
|
||||
// Coupled point to collocated coupled points. Coupled points are
|
||||
//- Helper: synchronise data with transforms
|
||||
template<class Type, class CombineOp>
|
||||
static void syncData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const labelListList& slaves,
|
||||
const labelListList& transformedSlaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const globalIndexAndTransform&,
|
||||
const CombineOp& cop,
|
||||
const bool isPosition
|
||||
);
|
||||
|
||||
|
||||
// Coupled point to coupled points. Coupled points are
|
||||
// points on any coupled patch.
|
||||
|
||||
//- Numbering of coupled points is according to coupledPatch.
|
||||
const globalIndex& globalPointNumbering() const;
|
||||
//- For every coupled point the indices into the field
|
||||
// distributed by below map.
|
||||
const labelListList& globalPointSlaves() const;
|
||||
const labelListList& globalPointTransformedSlaves() const;
|
||||
const mapDistribute& globalPointSlavesMap() const;
|
||||
//- Helper to synchronise mesh data
|
||||
//- Helper to synchronise mesh point data
|
||||
template<class Type, class CombineOp>
|
||||
void syncPointData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
const CombineOp& cop,
|
||||
const bool isPosition
|
||||
) const;
|
||||
|
||||
// Coupled edge to coupled edges.
|
||||
|
||||
const globalIndex& globalEdgeNumbering() const;
|
||||
const labelListList& globalEdgeSlaves() const;
|
||||
const labelListList& globalEdgeTransformedSlaves() const;
|
||||
const mapDistribute& globalEdgeSlavesMap() const;
|
||||
|
||||
// Coupled point to boundary faces. These are uncoupled boundary
|
||||
// faces only but include empty patches.
|
||||
|
||||
//- Numbering of boundary faces is face-mesh.nInternalFaces()
|
||||
const globalIndex& globalBoundaryFaceNumbering() const;
|
||||
const labelListList& globalPointBoundaryFaces() const;
|
||||
const mapDistribute& globalPointBoundaryFacesMap() const;
|
||||
|
||||
// Coupled point to boundary cell
|
||||
|
||||
//- From boundary cell to mesh cell
|
||||
const labelList& boundaryCells() const;
|
||||
|
||||
//- Numbering of boundary cells is according to boundaryCells()
|
||||
const globalIndex& globalBoundaryCellNumbering() const;
|
||||
const labelListList& globalPointBoundaryCells() const;
|
||||
const mapDistribute& globalPointBoundaryCellsMap() const;
|
||||
|
||||
|
||||
// Collocated & non-collocated
|
||||
|
||||
// Coupled point to all coupled points (collocated and
|
||||
// non-collocated).
|
||||
|
||||
const globalIndex& globalPointAllNumbering()const;
|
||||
const labelListList& globalPointAllSlaves() const;
|
||||
const mapDistribute& globalPointAllSlavesMap() const;
|
||||
//- Helper to synchronise mesh data
|
||||
template<class Type, class CombineOp>
|
||||
void syncPointAllData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
) const;
|
||||
|
||||
// Coupled edge to all coupled edges (same numbering as
|
||||
// collocated)
|
||||
|
||||
const labelListList& globalEdgeAllSlaves() const;
|
||||
const mapDistribute& globalEdgeAllSlavesMap() const;
|
||||
|
||||
// Other
|
||||
|
||||
@ -617,16 +512,6 @@ public:
|
||||
// full parallel analysis to determine shared points and
|
||||
// boundaries.
|
||||
void updateMesh();
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
bool write() const;
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const globalMeshData&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,13 +29,73 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncData
|
||||
(
|
||||
List<Type>& elems,
|
||||
const labelListList& slaves,
|
||||
const labelListList& transformedSlaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const globalIndexAndTransform& transforms,
|
||||
const CombineOp& cop,
|
||||
const bool isPosition
|
||||
)
|
||||
{
|
||||
// Pull slave data onto master
|
||||
slavesMap.distribute(transforms, elems, isPosition);
|
||||
|
||||
// Combine master data with slave data
|
||||
forAll(slaves, i)
|
||||
{
|
||||
Type& elem = elems[i];
|
||||
|
||||
const labelList& slavePoints = slaves[i];
|
||||
const labelList& transformSlavePoints = transformedSlaves[i];
|
||||
|
||||
if (slavePoints.size()+transformSlavePoints.size() > 0)
|
||||
{
|
||||
// Combine master with untransformed slave data
|
||||
forAll(slavePoints, j)
|
||||
{
|
||||
cop(elem, elems[slavePoints[j]]);
|
||||
}
|
||||
|
||||
// Combine master with transformed slave data
|
||||
forAll(transformSlavePoints, j)
|
||||
{
|
||||
cop(elem, elems[transformSlavePoints[j]]);
|
||||
}
|
||||
|
||||
|
||||
// Copy result back to slave slots
|
||||
forAll(slavePoints, j)
|
||||
{
|
||||
elems[slavePoints[j]] = elem;
|
||||
}
|
||||
forAll(transformSlavePoints, j)
|
||||
{
|
||||
elems[transformSlavePoints[j]] = elem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Push slave-slot data back to slaves
|
||||
slavesMap.reverseDistribute
|
||||
(
|
||||
transforms,
|
||||
elems.size(),
|
||||
elems,
|
||||
isPosition
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncPointData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const labelListList& slaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const CombineOp& cop
|
||||
const CombineOp& cop,
|
||||
const bool isPosition
|
||||
) const
|
||||
{
|
||||
if (pointData.size() != mesh_.nPoints())
|
||||
@ -46,81 +106,26 @@ void Foam::globalMeshData::syncPointData
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Transfer onto coupled patch
|
||||
const indirectPrimitivePatch& cpp = coupledPatch();
|
||||
const labelList& meshPoints = cpp.meshPoints();
|
||||
List<Type> cppFld(UIndirectList<Type>(pointData, cpp.meshPoints()));
|
||||
|
||||
// Copy mesh (point)data to coupled patch (point)data
|
||||
Field<Type> cppFld(slavesMap.constructSize());
|
||||
forAll(meshPoints, patchPointI)
|
||||
{
|
||||
cppFld[patchPointI] = pointData[meshPoints[patchPointI]];
|
||||
}
|
||||
|
||||
// Pull slave data onto master
|
||||
slavesMap.distribute(cppFld);
|
||||
|
||||
// Combine master data with slave data
|
||||
forAll(slaves, patchPointI)
|
||||
{
|
||||
const labelList& slavePoints = slaves[patchPointI];
|
||||
|
||||
// Combine master with slave data
|
||||
forAll(slavePoints, i)
|
||||
{
|
||||
cop(cppFld[patchPointI], cppFld[slavePoints[i]]);
|
||||
}
|
||||
// Copy result back to slave slots
|
||||
forAll(slavePoints, i)
|
||||
{
|
||||
cppFld[slavePoints[i]] = cppFld[patchPointI];
|
||||
}
|
||||
}
|
||||
|
||||
// Push master data back to slaves
|
||||
slavesMap.reverseDistribute(meshPoints.size(), cppFld);
|
||||
|
||||
// Update mesh (point)data from coupled patch (point)data
|
||||
forAll(meshPoints, patchPointI)
|
||||
{
|
||||
pointData[meshPoints[patchPointI]] = cppFld[patchPointI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncPointData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
const labelListList& slaves = globalPointSlaves();
|
||||
const mapDistribute& map = globalPointSlavesMap();
|
||||
|
||||
syncPointData
|
||||
syncData
|
||||
(
|
||||
pointData,
|
||||
slaves,
|
||||
map,
|
||||
cop
|
||||
cppFld,
|
||||
globalPointSlaves(),
|
||||
globalPointTransformedSlaves(),
|
||||
globalPointSlavesMap(),
|
||||
globalTransforms(),
|
||||
cop,
|
||||
isPosition
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncPointAllData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
syncPointData
|
||||
(
|
||||
pointData,
|
||||
globalPointAllSlaves(),
|
||||
globalPointAllSlavesMap(),
|
||||
cop
|
||||
);
|
||||
// Extract back onto mesh
|
||||
forAll(cpp.meshPoints(), i)
|
||||
{
|
||||
pointData[cpp.meshPoints()[i]] = cppFld[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,17 +39,15 @@ Description
|
||||
- f[0] ordering on patch faces to be ok.
|
||||
|
||||
Works by constructing equivalence lists for all the points on processor
|
||||
patches. These list are in globalIndex numbering (so consecutively numbered
|
||||
per processor)
|
||||
patches. These list are in globalIndexAndTransform numbering
|
||||
E.g.
|
||||
@verbatim
|
||||
((7 93)(4 731)(3 114))
|
||||
@endverbatim
|
||||
|
||||
means point 93 on proc7 is connected to point 731 on proc4 and 114 on proc3.
|
||||
It then gets the lowest numbered processor (the 'master') to request a
|
||||
sharedPoint label from processor0 and it redistributes this label back to
|
||||
the other processors in the equivalence list.
|
||||
It then assigns the lowest numbered processor to be the local 'master' and
|
||||
constructs a mapDistribute to send all data to this master.
|
||||
|
||||
Algorithm:
|
||||
- get meshPoints of all my points on processor patches and initialize
|
||||
@ -64,24 +62,9 @@ Description
|
||||
endloop until nothing changes
|
||||
|
||||
At this point one will have complete point-point connectivity for all
|
||||
points on processor patches. Now
|
||||
|
||||
- (optional)remove point equivalences of size 2. These are
|
||||
just normal points shared between two neighbouring procPatches.
|
||||
- collect on each processor points for which it is the master
|
||||
- request number of sharedPointLabels from the Pstream::master.
|
||||
|
||||
This information gets redistributed to all processors in a similar way
|
||||
as that in which the equivalence lists were collected:
|
||||
|
||||
- initialize the indices of shared points I am the master for
|
||||
loop
|
||||
- send my known sharedPoints + meshPoints to all neighbours
|
||||
- receive from all neighbour. Find which meshPoint on my processor
|
||||
the sharedpoint is connected to
|
||||
- mark indices for which information has changed
|
||||
endloop until nothing changes.
|
||||
|
||||
points on processor patches. Now (optionally) remove point
|
||||
equivalences of size 2. These are just normal points shared
|
||||
between two neighbouring procPatches.
|
||||
|
||||
Note: the data held is either mesh point labels (construct from mesh only)
|
||||
or patch point labels (construct from mesh and patch).
|
||||
@ -95,12 +78,9 @@ SourceFiles
|
||||
#define globalPoints_H
|
||||
|
||||
#include "DynamicList.H"
|
||||
#include "Map.H"
|
||||
#include "primitivePatch.H"
|
||||
#include "edgeList.H"
|
||||
#include "globalIndex.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "globalIndex.H"
|
||||
#include "globalIndexAndTransform.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -112,7 +92,7 @@ class polyMesh;
|
||||
class polyBoundaryMesh;
|
||||
class cyclicPolyPatch;
|
||||
class polyPatch;
|
||||
class coupledPolyPatch;
|
||||
class mapDistribute;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class globalPoints Declaration
|
||||
@ -120,91 +100,85 @@ class coupledPolyPatch;
|
||||
|
||||
class globalPoints
|
||||
{
|
||||
// Static data members
|
||||
|
||||
//- Offset to add to points (in globalIndices) originating from
|
||||
// collocated coupled points.
|
||||
static const label fromCollocated;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Mesh reference
|
||||
const polyMesh& mesh_;
|
||||
|
||||
//- Global numbering of points
|
||||
//- Global numbering of untransformed points
|
||||
globalIndex globalIndices_;
|
||||
|
||||
//- Global numbering of transformed points
|
||||
const globalIndexAndTransform globalTransforms_;
|
||||
|
||||
//- Sum of points on processor patches (unfiltered, point on 2 patches
|
||||
// counts as 2)
|
||||
const label nPatchPoints_;
|
||||
|
||||
//- All points on boundaries and their corresponding connected points
|
||||
// on other processors.
|
||||
DynamicList<labelList> procPoints_;
|
||||
DynamicList<labelPairList> procPoints_;
|
||||
|
||||
//- Map from mesh (or patch) point to index in procPoints
|
||||
Map<label> meshToProcPoint_;
|
||||
|
||||
//- Shared points used by this processor (= global point number)
|
||||
labelList sharedPointAddr_;
|
||||
|
||||
//- My mesh(or patch) points corresponding to the shared points
|
||||
labelList sharedPointLabels_;
|
||||
// Calculated mapDistribute addressing
|
||||
|
||||
//- Non-transformed connected points per point (in mapDistribute
|
||||
// indices)
|
||||
labelListList pointPoints_;
|
||||
|
||||
//- Transformed points per point (in mapDistribute indices)
|
||||
labelListList transformedPointPoints_;
|
||||
|
||||
//- Corresponding map
|
||||
autoPtr<mapDistribute> map_;
|
||||
|
||||
//- Total number of shared points.
|
||||
label nGlobalPoints_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
// Wrappers around global point numbering to add collocated bit
|
||||
|
||||
//- Convert into globalIndices and add collocated bit
|
||||
label toGlobal(const label, const bool isCollocated) const;
|
||||
|
||||
//- Is collocated bit set
|
||||
bool isCollocated(const label globalI) const;
|
||||
|
||||
//- Remove collocated bit
|
||||
label removeCollocated(const label globalI) const;
|
||||
|
||||
//- (remove collocated bit and) check if originates from local proc
|
||||
bool isLocal(const label globalI) const;
|
||||
|
||||
//- (remove collocated bit and) get originating processor
|
||||
label whichProcID(const label globalI) const;
|
||||
|
||||
//- (remove collocated bit and) convert to local number on processor
|
||||
label toLocal(const label procI, const label globalI) const;
|
||||
|
||||
//- (remove collocated bit and) convert to local number on
|
||||
// Pstream::myProcNo
|
||||
label toLocal(const label globalI) const;
|
||||
|
||||
|
||||
//- Helper function to sort according minimum proc, minimum index,
|
||||
// minimum transform
|
||||
class globalIndexAndTransformLessThan
|
||||
{
|
||||
public:
|
||||
bool operator()
|
||||
(
|
||||
const labelPair& a,
|
||||
const labelPair& b
|
||||
);
|
||||
};
|
||||
|
||||
//- Count all points on processorPatches. Is all points for which
|
||||
// information is collected.
|
||||
static label countPatchPoints(const polyBoundaryMesh&);
|
||||
|
||||
labelPairList addSendTransform
|
||||
(
|
||||
const label patchI,
|
||||
const labelPairList& info
|
||||
) const;
|
||||
|
||||
//- Add information about patchPointI in relative indices to send
|
||||
// buffers (patchFaces, indexInFace etc.)
|
||||
static void addToSend
|
||||
void addToSend
|
||||
(
|
||||
const primitivePatch&,
|
||||
const polyPatch&,
|
||||
const label patchPointI,
|
||||
const labelList&,
|
||||
const labelPairList&,
|
||||
DynamicList<label>& patchFaces,
|
||||
DynamicList<label>& indexInFace,
|
||||
DynamicList<labelList>& allInfo
|
||||
);
|
||||
DynamicList<labelPairList>& allInfo
|
||||
) const;
|
||||
|
||||
//- Merge info from neighbour into my data
|
||||
static bool mergeInfo
|
||||
(
|
||||
const labelList& nbrInfo,
|
||||
labelList& myInfo
|
||||
const labelPairList& nbrInfo,
|
||||
const label localPointI,
|
||||
labelPairList& myInfo
|
||||
);
|
||||
|
||||
//- From mesh point to 'local point'. Is the mesh point itself
|
||||
@ -223,18 +197,26 @@ class globalPoints
|
||||
);
|
||||
|
||||
//- Store (and merge) info for meshPointI
|
||||
bool storeInfo
|
||||
bool storeInitialInfo
|
||||
(
|
||||
const labelList& nbrInfo,
|
||||
const label localPointI,
|
||||
const bool isCollocated
|
||||
const labelPairList& nbrInfo,
|
||||
const label localPointI
|
||||
);
|
||||
|
||||
//- Store (and merge) info for meshPointI
|
||||
bool mergeInfo
|
||||
(
|
||||
const labelPairList& nbrInfo,
|
||||
const label localPointI
|
||||
);
|
||||
|
||||
//- Get the signs for the individual transforms
|
||||
FixedList<label, 3> transformBits(const label transformIndex) const;
|
||||
|
||||
void printProcPoints
|
||||
(
|
||||
const labelList& patchToMeshPoint,
|
||||
const labelList& pointInfo,
|
||||
Ostream& os
|
||||
const labelPairList& pointInfo
|
||||
) const;
|
||||
|
||||
//- Initialize procPoints_ to my patch points. allPoints = true:
|
||||
@ -260,6 +242,7 @@ class globalPoints
|
||||
(
|
||||
const bool mergeSeparated,
|
||||
const Map<label>&,
|
||||
const labelList&,
|
||||
PstreamBuffers&,
|
||||
labelHashSet&
|
||||
);
|
||||
@ -268,34 +251,6 @@ class globalPoints
|
||||
// Used to remove normal face-face connected points.
|
||||
void remove(const labelList& patchToMeshPoint, const Map<label>&);
|
||||
|
||||
//- Compact out unused elements of procPoints.
|
||||
void compact(const labelList& patchToMeshPoint);
|
||||
|
||||
//- Get indices of point for which I am master (lowest numbered proc)
|
||||
labelList getMasterPoints(const labelList& patchToMeshPoint) const;
|
||||
|
||||
|
||||
//- Send subset of shared points to neighbours
|
||||
void sendSharedPoints
|
||||
(
|
||||
const bool mergeSeparated,
|
||||
PstreamBuffers&,
|
||||
const DynamicList<label>&
|
||||
) const;
|
||||
|
||||
//- Take over any local shared points
|
||||
void extendSharedPoints(const Map<label>&, DynamicList<label>&);
|
||||
|
||||
//- Receive shared points and update subset.
|
||||
void receiveSharedPoints
|
||||
(
|
||||
const bool mergeSeparated,
|
||||
const Map<label>& meshToPatchPoint,
|
||||
const Map<label>& meshToShared,
|
||||
PstreamBuffers&,
|
||||
DynamicList<label>&
|
||||
);
|
||||
|
||||
//- Return mesh points of other side in same order as my meshPoints.
|
||||
static labelList reverseMeshPoints(const cyclicPolyPatch&);
|
||||
|
||||
@ -325,7 +280,7 @@ public:
|
||||
|
||||
//- Construct from mesh.
|
||||
// keepAllPoints = false : filter out points that are on two
|
||||
// neighbouring coupled patches (so can be swapped)
|
||||
// neighbouring coupled patches only (so can be swapped)
|
||||
// mergeSeparated:
|
||||
// true : merge coupled points across separated patches.
|
||||
// false : do not merge across coupled separated patches.
|
||||
@ -338,8 +293,7 @@ public:
|
||||
|
||||
//- Construct from mesh and patch of coupled faces. Difference with
|
||||
// construct from mesh only is that this stores the meshToProcPoint,
|
||||
// procPoints and sharedPointLabels as patch local point labels
|
||||
// instead of mesh point labels.
|
||||
// procPoints as patch local point labels instead of mesh point labels.
|
||||
globalPoints
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -353,43 +307,68 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Global numbering of untransformed (mesh or patch) points
|
||||
const globalIndex& globalIndices() const
|
||||
{
|
||||
return globalIndices_;
|
||||
}
|
||||
|
||||
//- Global numbering of transformed (mesh or patch) points
|
||||
const globalIndexAndTransform& globalTransforms() const
|
||||
{
|
||||
return globalTransforms_;
|
||||
}
|
||||
|
||||
//- Non-transformed connected points per point (in mapDistribute
|
||||
// indices)
|
||||
const labelListList& pointPoints() const
|
||||
{
|
||||
return pointPoints_;
|
||||
}
|
||||
|
||||
//- Non-transformed connected points per point (in mapDistribute
|
||||
// indices)
|
||||
labelListList& pointPoints()
|
||||
{
|
||||
return pointPoints_;
|
||||
}
|
||||
|
||||
//- Transformed points per point (in mapDistribute indices)
|
||||
const labelListList& transformedPointPoints() const
|
||||
{
|
||||
return transformedPointPoints_;
|
||||
}
|
||||
|
||||
//- Transformed points per point (in mapDistribute indices)
|
||||
labelListList& transformedPointPoints()
|
||||
{
|
||||
return transformedPointPoints_;
|
||||
}
|
||||
|
||||
//- Corresponding map
|
||||
const mapDistribute& map() const
|
||||
{
|
||||
return map_();
|
||||
}
|
||||
|
||||
//- Corresponding map
|
||||
mapDistribute& map()
|
||||
{
|
||||
return map_();
|
||||
}
|
||||
|
||||
//- From (mesh or patch) point to index in procPoints
|
||||
const Map<label>& meshToProcPoint() const
|
||||
{
|
||||
return meshToProcPoint_;
|
||||
}
|
||||
|
||||
//- procPoints is per point the connected points (in global
|
||||
// point numbers)
|
||||
const DynamicList<labelList>& procPoints() const
|
||||
//- procPoints is per point the connected points (in
|
||||
// globalTransformAndIndex point numbers)
|
||||
const DynamicList<labelPairList>& procPoints() const
|
||||
{
|
||||
return procPoints_;
|
||||
}
|
||||
|
||||
//- Global numbering of (mesh or patch) points
|
||||
const globalIndex& globalIndices() const
|
||||
{
|
||||
return globalIndices_;
|
||||
}
|
||||
|
||||
//- shared points used by this processor (= global point number)
|
||||
const labelList& sharedPointAddr() const
|
||||
{
|
||||
return sharedPointAddr_;
|
||||
}
|
||||
|
||||
//- my (mesh or patch)points corresponding to the shared points
|
||||
const labelList& sharedPointLabels() const
|
||||
{
|
||||
return sharedPointLabels_;
|
||||
}
|
||||
|
||||
//- total number of shared points
|
||||
label nGlobalPoints() const
|
||||
{
|
||||
return nGlobalPoints_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,22 +35,92 @@ Note:
|
||||
Schedule is a list of processor pairs (one send, one receive. One of
|
||||
them will be myself) which forms a scheduled (i.e. non-buffered) exchange.
|
||||
See distribute on how to use it.
|
||||
Note2: number of items send on one processor have to equal the number
|
||||
Note2: number of items sent on one processor have to equal the number
|
||||
of items received on the other processor.
|
||||
|
||||
Constructors using compact numbering: all my own elements first
|
||||
(whether used or not) followed by used-only remote elements.
|
||||
To aid constructing these maps there are the constructors from global
|
||||
numbering, either with or without transforms.
|
||||
|
||||
- without transforms:
|
||||
Constructors using compact numbering: layout is
|
||||
- all my own elements first (whether used or not)
|
||||
- followed by used-only remote elements sorted by remote processor.
|
||||
So e.g 4 procs and on proc 1 the compact
|
||||
table will first have all globalIndex.localSize() elements from proc1
|
||||
followed by used-only elements of proc0, proc2, proc3.
|
||||
The constructed mapDistribute sends the local elements from and
|
||||
receives the remote elements into their compact position.
|
||||
compactMap[procI] is the position of elements from procI in the compact
|
||||
map. compactMap[myProcNo()] is empty since trivial addressing. The indices
|
||||
into compactMap[procI] are local, not global, indices.
|
||||
map. compactMap[myProcNo()] is empty since trivial addressing.
|
||||
|
||||
It rewrites the input global indices into indices into the constructed
|
||||
data.
|
||||
|
||||
|
||||
- with transforms:
|
||||
This requires the precalculated set of possible transforms
|
||||
(globalIndexAndTransform). These are given as permutations (+, -, or none)
|
||||
of up to 3 independent transforms.
|
||||
The layout of the data is
|
||||
- all my own elements first (whether used or not)
|
||||
- followed by used-only remote elements sorted by remote processor.
|
||||
- followed by - for each transformation index - the set of local or
|
||||
remote elements with that transformation.
|
||||
The inputs for the constructor are
|
||||
- the set of untransformed local or remote indices in globalIndex
|
||||
numbering. These get rewritten to be indices into the layout of the data.
|
||||
- the set of transformed local or remote indices in globalIndexAndTransform
|
||||
encoding. These are labelPairs.
|
||||
|
||||
Any distribute with transforms is now done as:
|
||||
1. exchange data with other processors and receive these into the
|
||||
slots for that processor
|
||||
2. for all transformations transform a subset of the data according
|
||||
to transformElements_[transformI] and store this starting from
|
||||
transformStart_[transformI]
|
||||
|
||||
In the same way a reverse distribute will
|
||||
1. apply the inverse transform to the data starting at
|
||||
transformStart_[transformI] and copy the result back into the
|
||||
transformElements_[transformI]. These might be local or remote slots.
|
||||
2. the data in the remote slots will now be sent back to the correct
|
||||
location in the originating processor.
|
||||
|
||||
E.g. a map to handle
|
||||
- mesh points on a mesh with
|
||||
- 1 cyclic so 3 permutations (+,-,none) will have layout
|
||||
- on e.g. processor 1 out of 2:
|
||||
|
||||
+------+ <- transformStart[2]
|
||||
| |
|
||||
| | <- transform2 applied to data in local or remote slots
|
||||
| |
|
||||
+------+ <- transformStart[1]
|
||||
| |
|
||||
| | <- transform1 applied to data in local or remote slots
|
||||
| |
|
||||
+------+ <- transformStart[1]
|
||||
| |
|
||||
| | <- transform0 applied to data in local or remote slots
|
||||
| |
|
||||
+------+ <- transformStart[0]
|
||||
| |
|
||||
| | <- data from proc2
|
||||
| |
|
||||
+------+
|
||||
| |
|
||||
| | <- data from proc0
|
||||
| |
|
||||
+------+ <- mesh.nPoints()
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
+------+ 0
|
||||
|
||||
|
||||
SourceFiles
|
||||
mapDistribute.C
|
||||
mapDistributeTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -62,6 +132,7 @@ SourceFiles
|
||||
#include "Pstream.H"
|
||||
#include "boolList.H"
|
||||
#include "Map.H"
|
||||
#include "point.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -71,6 +142,7 @@ namespace Foam
|
||||
class mapPolyMesh;
|
||||
class globalIndex;
|
||||
class PstreamBuffers;
|
||||
class globalIndexAndTransform;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mapDistribute Declaration
|
||||
@ -89,6 +161,16 @@ class mapDistribute
|
||||
//- Maps from subsetted data to new reconstructed data
|
||||
labelListList constructMap_;
|
||||
|
||||
// Optional transformation
|
||||
|
||||
//- For every globalIndexAndTransform::transformPermutations
|
||||
// gives the elements that need to be transformed
|
||||
labelListList transformElements_;
|
||||
|
||||
//- Destination in constructMap for transformed elements
|
||||
labelList transformStart_;
|
||||
|
||||
|
||||
//- Schedule
|
||||
mutable autoPtr<List<labelPair> > schedulePtr_;
|
||||
|
||||
@ -102,10 +184,73 @@ class mapDistribute
|
||||
const label receivedSize
|
||||
);
|
||||
|
||||
void calcCompactAddressing
|
||||
(
|
||||
const globalIndex& globalNumbering,
|
||||
const labelList& elements,
|
||||
List<Map<label> >& compactMap
|
||||
) const;
|
||||
void calcCompactAddressing
|
||||
(
|
||||
const globalIndex& globalNumbering,
|
||||
const labelListList& elements,
|
||||
List<Map<label> >& compactMap
|
||||
) const;
|
||||
|
||||
void exchangeAddressing
|
||||
(
|
||||
const globalIndex& globalNumbering,
|
||||
labelList& elements,
|
||||
List<Map<label> >& compactMap,
|
||||
labelList& compactStart
|
||||
);
|
||||
void exchangeAddressing
|
||||
(
|
||||
const globalIndex& globalNumbering,
|
||||
labelListList& elements,
|
||||
List<Map<label> >& compactMap,
|
||||
labelList& compactStart
|
||||
);
|
||||
|
||||
|
||||
//- Helper function: copy transformElements without transformation
|
||||
template<class T>
|
||||
void applyDummyTransforms(List<T>& field) const;
|
||||
|
||||
template<class T> //, class CombineOp>
|
||||
void applyTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<T>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const;
|
||||
|
||||
//- Helper function: copy transformElements without transformation
|
||||
template<class T>
|
||||
void applyDummyInverseTransforms(List<T>& field) const;
|
||||
|
||||
template<class T> //, class CombineOp>
|
||||
void applyInverseTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<T>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Declare name of the class and its debug switch
|
||||
ClassName("mapDistribute");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
mapDistribute();
|
||||
|
||||
//- Construct from components
|
||||
mapDistribute
|
||||
(
|
||||
@ -114,6 +259,16 @@ public:
|
||||
const Xfer<labelListList>& constructMap
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
mapDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
const Xfer<labelListList>& subMap,
|
||||
const Xfer<labelListList>& constructMap,
|
||||
const Xfer<labelListList>& transformElements,
|
||||
const Xfer<labelList>& transformStart
|
||||
);
|
||||
|
||||
//- Construct from reverse addressing: per data item the send
|
||||
// processor and the receive processor. All processors get same data.
|
||||
mapDistribute
|
||||
@ -143,6 +298,36 @@ public:
|
||||
List<Map<label> >& compactMap
|
||||
);
|
||||
|
||||
//- Construct from list of (possibly remote) untransformed elements
|
||||
// in globalIndex numbering (or -1) and (possibly remote)
|
||||
// transformded elements in globalIndexAndTransform numbering.
|
||||
// Determines compact numbering (see above) and
|
||||
// distribute map to get data into this ordering and renumbers the
|
||||
// elements to be in compact numbering.
|
||||
mapDistribute
|
||||
(
|
||||
const globalIndex&,
|
||||
labelList& untransformedElements,
|
||||
const globalIndexAndTransform&,
|
||||
const labelPairList& transformedElements,
|
||||
labelList& transformedIndices,
|
||||
List<Map<label> >& compactMap
|
||||
);
|
||||
|
||||
//- As above but with ListLists.
|
||||
mapDistribute
|
||||
(
|
||||
const globalIndex&,
|
||||
labelListList& cellCells,
|
||||
const globalIndexAndTransform&,
|
||||
const List<labelPairList>& transformedElements,
|
||||
labelListList& transformedIndices,
|
||||
List<Map<label> >& compactMap
|
||||
);
|
||||
|
||||
//- Construct by transferring parameter content
|
||||
mapDistribute(const Xfer<mapDistribute>&);
|
||||
|
||||
//- Construct copy
|
||||
mapDistribute(const mapDistribute&);
|
||||
|
||||
@ -187,6 +372,19 @@ public:
|
||||
return constructMap_;
|
||||
}
|
||||
|
||||
//- For every globalIndexAndTransform::transformPermutations
|
||||
// gives the elements that need to be transformed
|
||||
const labelListList& transformElements() const
|
||||
{
|
||||
return transformElements_;
|
||||
}
|
||||
|
||||
//- Destination in constructMap for transformed elements
|
||||
const labelList& transformStart() const
|
||||
{
|
||||
return transformStart_;
|
||||
}
|
||||
|
||||
//- Calculate a schedule. See above.
|
||||
static List<labelPair> schedule
|
||||
(
|
||||
@ -200,6 +398,12 @@ public:
|
||||
|
||||
// Other
|
||||
|
||||
//- Transfer the contents of the argument and annul the argument.
|
||||
void transfer(mapDistribute&);
|
||||
|
||||
//- Transfer contents to the Xfer container
|
||||
Xfer<mapDistribute> xfer();
|
||||
|
||||
//- Helper for construct from globalIndex. Renumbers element
|
||||
// (in globalIndex numbering) into compact indices.
|
||||
static label renumber
|
||||
@ -245,88 +449,36 @@ public:
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void distribute(List<T>& fld) const
|
||||
{
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
}
|
||||
void distribute(List<T>& fld, const bool dummyTransform = true)
|
||||
const;
|
||||
|
||||
//- Same but with transforms
|
||||
template<class T>
|
||||
void distribute
|
||||
(
|
||||
const globalIndexAndTransform&,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const;
|
||||
|
||||
//- Reverse distribute data using default commsType.
|
||||
template<class T>
|
||||
void reverseDistribute(const label constructSize, List<T>& fld)
|
||||
const
|
||||
{
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
}
|
||||
void reverseDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
List<T>&,
|
||||
const bool dummyTransform = true
|
||||
) const;
|
||||
|
||||
//- Same but with transforms
|
||||
template<class T>
|
||||
void reverseDistribute
|
||||
(
|
||||
const globalIndexAndTransform&,
|
||||
const label constructSize,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const;
|
||||
|
||||
//- Reverse distribute data using default commsType.
|
||||
// Since constructSize might be larger than supplied size supply
|
||||
@ -336,53 +488,20 @@ public:
|
||||
(
|
||||
const label constructSize,
|
||||
const T& nullValue,
|
||||
List<T>& fld
|
||||
)
|
||||
const
|
||||
{
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
}
|
||||
List<T>& fld,
|
||||
const bool dummyTransform = true
|
||||
) const;
|
||||
|
||||
//- Same but with transforms
|
||||
template<class T>
|
||||
void reverseDistribute
|
||||
(
|
||||
const globalIndexAndTransform&,
|
||||
const label constructSize,
|
||||
const T& nullValue,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const;
|
||||
|
||||
//- Do all sends using PstreamBuffers
|
||||
template<class T>
|
||||
@ -391,6 +510,9 @@ public:
|
||||
template<class T>
|
||||
void receive(PstreamBuffers&, List<T>&) const;
|
||||
|
||||
//- Debug: print layout
|
||||
void printLayout(Ostream& os) const;
|
||||
|
||||
//- Correct for topo change.
|
||||
void updateMesh(const mapPolyMesh&)
|
||||
{
|
||||
@ -406,6 +528,24 @@ public:
|
||||
|
||||
};
|
||||
|
||||
//- Specialisation for transforms that can apply positional transform
|
||||
template<>
|
||||
void mapDistribute::applyTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<point>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const;
|
||||
|
||||
template<> //, class CombineOp>
|
||||
void mapDistribute::applyInverseTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<point>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,8 @@ License
|
||||
#include "Pstream.H"
|
||||
#include "PstreamBuffers.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
#include "globalIndexAndTransform.H"
|
||||
#include "transformField.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -774,4 +776,359 @@ void Foam::mapDistribute::receive(PstreamBuffers& pBufs, List<T>& field) const
|
||||
}
|
||||
|
||||
|
||||
// In case of no transform: copy elements
|
||||
template<class T>
|
||||
void Foam::mapDistribute::applyDummyTransforms(List<T>& field) const
|
||||
{
|
||||
forAll(transformElements_, trafoI)
|
||||
{
|
||||
const labelList& elems = transformElements_[trafoI];
|
||||
|
||||
label n = transformStart_[trafoI];
|
||||
|
||||
forAll(elems, i)
|
||||
{
|
||||
field[n++] = field[elems[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// In case of no transform: copy elements
|
||||
template<class T>
|
||||
void Foam::mapDistribute::applyDummyInverseTransforms(List<T>& field) const
|
||||
{
|
||||
forAll(transformElements_, trafoI)
|
||||
{
|
||||
const labelList& elems = transformElements_[trafoI];
|
||||
label n = transformStart_[trafoI];
|
||||
|
||||
forAll(elems, i)
|
||||
{
|
||||
field[elems[i]] = field[n++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Calculate transformed elements.
|
||||
template<class T> //, class CombineOp>
|
||||
void Foam::mapDistribute::applyTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<T>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
if (isPosition)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"mapDistribute::applyTransforms\n"
|
||||
"(\n"
|
||||
" const globalIndexAndTransform&,\n"
|
||||
" List<T>&,\n"
|
||||
" const bool\n"
|
||||
") const\n"
|
||||
) << "It does not make sense to apply position transformation"
|
||||
<< " for anything else than pointFields."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const List<vectorTensorTransform>& totalTransform =
|
||||
globalTransforms.transformPermutations();
|
||||
|
||||
forAll(totalTransform, trafoI)
|
||||
{
|
||||
const vectorTensorTransform& vt = totalTransform[trafoI];
|
||||
const labelList& elems = transformElements_[trafoI];
|
||||
label n = transformStart_[trafoI];
|
||||
|
||||
// Could be optimised to avoid memory allocations
|
||||
Field<T> transformFld(transform(vt.R(), Field<T>(field, elems)));
|
||||
|
||||
forAll(transformFld, i)
|
||||
{
|
||||
//cop(field[n++], transformFld[i]);
|
||||
field[n++] = transformFld[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Calculate transformed elements.
|
||||
template<class T> //, class CombineOp>
|
||||
void Foam::mapDistribute::applyInverseTransforms
|
||||
(
|
||||
const globalIndexAndTransform& globalTransforms,
|
||||
List<T>& field,
|
||||
const bool isPosition
|
||||
//const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
if (isPosition)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"mapDistribute::applyInverseTransforms\n"
|
||||
"(\n"
|
||||
" const globalIndexAndTransform&,\n"
|
||||
" List<T>&,\n"
|
||||
" const bool\n"
|
||||
") const\n"
|
||||
) << "It does not make sense to apply position transformation"
|
||||
<< " for anything else than pointFields."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const List<vectorTensorTransform>& totalTransform =
|
||||
globalTransforms.transformPermutations();
|
||||
|
||||
forAll(totalTransform, trafoI)
|
||||
{
|
||||
const vectorTensorTransform& vt = totalTransform[trafoI];
|
||||
const labelList& elems = transformElements_[trafoI];
|
||||
label n = transformStart_[trafoI];
|
||||
|
||||
// Could be optimised to avoid memory allocations
|
||||
Field<T> transformFld(SubField<T>(field, elems.size(), n));
|
||||
transform(transformFld, vt.R().T(), transformFld);
|
||||
|
||||
forAll(transformFld, i)
|
||||
{
|
||||
//cop(field[elems[i]], transformFld[i]);
|
||||
field[elems[i]] = transformFld[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void Foam::mapDistribute::distribute
|
||||
(
|
||||
List<T>& fld,
|
||||
const bool dummyTransform
|
||||
) const
|
||||
{
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize_,
|
||||
subMap_,
|
||||
constructMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
|
||||
//- Fill in transformed slots with copies
|
||||
if (dummyTransform)
|
||||
{
|
||||
applyDummyTransforms(fld);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Reverse distribute data using default commsType.
|
||||
template<class T>
|
||||
void Foam::mapDistribute::reverseDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
List<T>& fld,
|
||||
const bool dummyTransform
|
||||
) const
|
||||
{
|
||||
fld.setSize(constructSize);
|
||||
|
||||
if (dummyTransform)
|
||||
{
|
||||
applyDummyInverseTransforms(fld);
|
||||
}
|
||||
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Reverse distribute data using default commsType.
|
||||
// Since constructSize might be larger than supplied size supply
|
||||
// a nullValue
|
||||
template<class T>
|
||||
void Foam::mapDistribute::reverseDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
const T& nullValue,
|
||||
List<T>& fld,
|
||||
const bool dummyTransform
|
||||
) const
|
||||
{
|
||||
fld.setSize(constructSize);
|
||||
|
||||
if (dummyTransform)
|
||||
{
|
||||
applyDummyInverseTransforms(fld);
|
||||
}
|
||||
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
else if (Pstream::defaultCommsType == Pstream::scheduled)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
schedule(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
distribute
|
||||
(
|
||||
Pstream::blocking,
|
||||
List<labelPair>(),
|
||||
constructSize,
|
||||
constructMap_,
|
||||
subMap_,
|
||||
fld,
|
||||
eqOp<T>(),
|
||||
nullValue
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//- Distribute data using default commsType.
|
||||
template<class T>
|
||||
void Foam::mapDistribute::distribute
|
||||
(
|
||||
const globalIndexAndTransform& git,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const
|
||||
{
|
||||
// Distribute. Leave out dummy transforms since we're doing them ourselves
|
||||
distribute(fld, false);
|
||||
// Do transforms
|
||||
applyTransforms(git, fld, isPosition); //, eqOp<T>());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::mapDistribute::reverseDistribute
|
||||
(
|
||||
const globalIndexAndTransform& git,
|
||||
const label constructSize,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const
|
||||
{
|
||||
// Fill slots with reverse-transformed data. Note that it also copies
|
||||
// back into the non-remote part of fld even though these values are not
|
||||
// used.
|
||||
applyInverseTransforms(git, fld, isPosition); //, eqOp<T>());
|
||||
|
||||
// And send back (the remote slots). Disable dummy transformations.
|
||||
reverseDistribute(constructSize, fld, false);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::mapDistribute::reverseDistribute
|
||||
(
|
||||
const globalIndexAndTransform& git,
|
||||
const label constructSize,
|
||||
const T& nullValue,
|
||||
List<T>& fld,
|
||||
const bool isPosition
|
||||
) const
|
||||
{
|
||||
// Fill slots with reverse-transformed data Note that it also copies
|
||||
// back into the non-remote part of fld even though these values are not
|
||||
// used.
|
||||
applyInverseTransforms(git, fld, isPosition); //, eqOp<T>());
|
||||
|
||||
// And send back (the remote slots) Disable dummy transformations.
|
||||
reverseDistribute(constructSize, nullValue, fld, false);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -673,6 +673,8 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
HashSet<word> patchNames(2*size());
|
||||
|
||||
forAll(bm, patchI)
|
||||
{
|
||||
if (bm[patchI].start() != nextPatchStart && !hasError)
|
||||
@ -689,6 +691,17 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
|
||||
<< " Suppressing future warnings." << endl;
|
||||
}
|
||||
|
||||
if (!patchNames.insert(bm[patchI].name()) && !hasError)
|
||||
{
|
||||
hasError = true;
|
||||
|
||||
Info<< " ****Duplicate boundary patch " << patchI
|
||||
<< " named " << bm[patchI].name()
|
||||
<< " of type " << bm[patchI].type()
|
||||
<< "." << endl
|
||||
<< "Suppressing future warnings." << endl;
|
||||
}
|
||||
|
||||
nextPatchStart += bm[patchI].size();
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,7 +45,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
typedef List<labelPair> labelPairList;
|
||||
class polyMesh;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
@ -276,9 +276,16 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
|
||||
if (transform_ == ROTATIONAL && !parallel() && forwardT().size() > 1)
|
||||
{
|
||||
const_cast<tensorField&>(forwardT()).setSize(1);
|
||||
const_cast<tensorField&>(reverseT()).setSize(1);
|
||||
// Get index of maximum area face to minimise truncation errors.
|
||||
label max0I = findMaxArea(half0.points(), half0);
|
||||
|
||||
const tensor fwdT = forwardT()[max0I];
|
||||
const_cast<tensorField&>(forwardT()) = tensorField(1, fwdT);
|
||||
const tensor revT = reverseT()[max0I];
|
||||
const_cast<tensorField&>(reverseT()) = tensorField(1, revT);
|
||||
const bool coll = collocated()[max0I];
|
||||
const_cast<boolList&>(collocated()).setSize(1);
|
||||
const_cast<boolList&>(collocated())[0] = coll;
|
||||
|
||||
WarningIn
|
||||
(
|
||||
@ -293,8 +300,9 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
) << "For patch " << name()
|
||||
<< " calculated non-uniform transform tensor even though"
|
||||
<< " the transform type is " << transformTypeNames[transform_]
|
||||
<< ". Setting the transformation tensor to be a uniform"
|
||||
<< " rotation."
|
||||
<< "." << nl
|
||||
<< " Setting the transformation tensor to be a uniform"
|
||||
<< " rotation calculated from face " << max0I
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -695,9 +703,43 @@ Foam::cyclicPolyPatch::~cyclicPolyPatch()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::cyclicPolyPatch::neighbPatchID() const
|
||||
{
|
||||
if (neighbPatchID_ == -1)
|
||||
{
|
||||
neighbPatchID_ = this->boundaryMesh().findPatchID(neighbPatchName_);
|
||||
|
||||
if (neighbPatchID_ == -1)
|
||||
{
|
||||
FatalErrorIn("cyclicPolyPatch::neighbPatchID() const")
|
||||
<< "Illegal neighbourPatch name " << neighbPatchName_
|
||||
<< endl << "Valid patch names are "
|
||||
<< this->boundaryMesh().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Check that it is a cyclic
|
||||
const cyclicPolyPatch& nbrPatch = refCast<const cyclicPolyPatch>
|
||||
(
|
||||
this->boundaryMesh()[neighbPatchID_]
|
||||
);
|
||||
|
||||
if (nbrPatch.neighbPatchName() != name())
|
||||
{
|
||||
WarningIn("cyclicPolyPatch::neighbPatchID() const")
|
||||
<< "Patch " << name()
|
||||
<< " specifies neighbour patch " << neighbPatchName()
|
||||
<< endl << " but that in return specifies "
|
||||
<< nbrPatch.neighbPatchName()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
return neighbPatchID_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
|
||||
{
|
||||
if (!parallel())
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -197,6 +197,10 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
//- Declare friendship with processorCyclicPolyPatch
|
||||
friend class processorCyclicPolyPatch;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("cyclic");
|
||||
|
||||
@ -321,25 +325,7 @@ public:
|
||||
}
|
||||
|
||||
//- Neighbour patchID.
|
||||
virtual label neighbPatchID() const
|
||||
{
|
||||
if (neighbPatchID_ == -1)
|
||||
{
|
||||
neighbPatchID_ = this->boundaryMesh().findPatchID
|
||||
(
|
||||
neighbPatchName_
|
||||
);
|
||||
if (neighbPatchID_ == -1)
|
||||
{
|
||||
FatalErrorIn("cyclicPolyPatch::neighbPatchID() const")
|
||||
<< "Illegal neighbourPatch name " << neighbPatchName_
|
||||
<< endl << "Valid patch names are "
|
||||
<< this->boundaryMesh().names()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return neighbPatchID_;
|
||||
}
|
||||
virtual label neighbPatchID() const;
|
||||
|
||||
virtual bool owner() const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "processorCyclicPolyPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "SubField.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -171,9 +172,9 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
// - or do we not auto-calculate the transformation but
|
||||
// have option of reading it.
|
||||
|
||||
// Update underlying cyclic
|
||||
// Update underlying cyclic halves. Need to do both since only one
|
||||
// half might be present as a processorCyclic.
|
||||
coupledPolyPatch& pp = const_cast<coupledPolyPatch&>(referPatch());
|
||||
|
||||
pp.calcGeometry
|
||||
(
|
||||
*this,
|
||||
@ -184,6 +185,21 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
neighbFaceAreas(),
|
||||
neighbFaceCellCentres()
|
||||
);
|
||||
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
{
|
||||
const cyclicPolyPatch& cpp = refCast<const cyclicPolyPatch>(pp);
|
||||
const_cast<cyclicPolyPatch&>(cpp.neighbPatch()).calcGeometry
|
||||
(
|
||||
*this,
|
||||
neighbFaceCentres(),
|
||||
neighbFaceAreas(),
|
||||
neighbFaceCellCentres(),
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
faceCellCentres()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,7 +24,6 @@ License
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "syncTools.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -99,24 +98,6 @@ void Foam::syncTools::transform::operator()
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Does anyone have couples? Since meshes might have 0 cells and 0 proc
|
||||
// boundaries need to reduce this info.
|
||||
bool Foam::syncTools::hasCouples(const polyBoundaryMesh& patches)
|
||||
{
|
||||
bool hasAnyCouples = false;
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (patches[patchI].coupled())
|
||||
{
|
||||
hasAnyCouples = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnReduce(hasAnyCouples, orOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
// Determines for every point whether it is coupled and if so sets only one.
|
||||
Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
||||
{
|
||||
@ -125,12 +106,21 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
||||
|
||||
const globalMeshData& globalData = mesh.globalData();
|
||||
const labelList& meshPoints = globalData.coupledPatch().meshPoints();
|
||||
const labelListList& pointSlaves = globalData.globalPointAllSlaves();
|
||||
const labelListList& slaves = globalData.globalPointSlaves();
|
||||
const labelListList& transformedSlaves =
|
||||
globalData.globalPointTransformedSlaves();
|
||||
|
||||
forAll(meshPoints, coupledPointI)
|
||||
{
|
||||
label meshPointI = meshPoints[coupledPointI];
|
||||
if (pointSlaves[coupledPointI].size() > 0)
|
||||
if
|
||||
(
|
||||
(
|
||||
slaves[coupledPointI].size()
|
||||
+ transformedSlaves[coupledPointI].size()
|
||||
)
|
||||
> 0
|
||||
)
|
||||
{
|
||||
isMasterPoint[meshPointI] = true;
|
||||
}
|
||||
@ -161,12 +151,21 @@ Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh)
|
||||
|
||||
const globalMeshData& globalData = mesh.globalData();
|
||||
const labelList& meshEdges = globalData.coupledPatchMeshEdges();
|
||||
const labelListList& edgeSlaves = globalData.globalEdgeAllSlaves();
|
||||
const labelListList& slaves = globalData.globalEdgeSlaves();
|
||||
const labelListList& transformedSlaves =
|
||||
globalData.globalEdgeTransformedSlaves();
|
||||
|
||||
forAll(meshEdges, coupledEdgeI)
|
||||
{
|
||||
label meshEdgeI = meshEdges[coupledEdgeI];
|
||||
if (edgeSlaves[coupledEdgeI].size() > 0)
|
||||
if
|
||||
(
|
||||
(
|
||||
slaves[coupledEdgeI].size()
|
||||
+ transformedSlaves[coupledEdgeI].size()
|
||||
)
|
||||
> 0
|
||||
)
|
||||
{
|
||||
isMasterEdge[meshEdgeI] = true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,12 +33,6 @@ Description
|
||||
- null value which gets overridden by any valid value.
|
||||
- transform function
|
||||
|
||||
note:Can apply coordinate rotation/separation on cyclics but only for faces
|
||||
or if there is a single rotation/separation tensor.
|
||||
note:syncPointList or syncEdgeList will visit shared points/edges
|
||||
multiple times (once through patch exchange, once through shared
|
||||
points reduce). Should be replaced by pointMesh functionality.
|
||||
|
||||
SourceFiles
|
||||
syncTools.C
|
||||
syncToolsTemplates.C
|
||||
@ -48,9 +42,7 @@ SourceFiles
|
||||
#ifndef syncTools_H
|
||||
#define syncTools_H
|
||||
|
||||
#include "UList.H"
|
||||
#include "Pstream.H"
|
||||
#include "Map.H"
|
||||
#include "EdgeMap.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "polyMesh.H"
|
||||
@ -72,9 +64,6 @@ class syncTools
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Check whether uses couples.
|
||||
static bool hasCouples(const polyBoundaryMesh&);
|
||||
|
||||
//- Combine value with existing value in map.
|
||||
template <class T, class CombineOp>
|
||||
static void combine
|
||||
@ -174,41 +163,41 @@ public:
|
||||
const CombineOp& cop,
|
||||
const TransformOp& top
|
||||
);
|
||||
|
||||
//- Synchronize values on all mesh points.
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
static void syncPointList
|
||||
(
|
||||
const polyMesh&,
|
||||
UList<T>&,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
);
|
||||
|
||||
//- Synchronize values on selected mesh points.
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
static void syncPointList
|
||||
(
|
||||
const polyMesh&,
|
||||
const labelList& meshPoints,
|
||||
UList<T>&,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
);
|
||||
|
||||
//- Synchronize values on all mesh edges.
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
static void syncEdgeList
|
||||
(
|
||||
const polyMesh&,
|
||||
UList<T>&,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
);
|
||||
|
||||
//
|
||||
// //- Synchronize values on all mesh points.
|
||||
// template <class T, class CombineOp, class TransformOp>
|
||||
// static void syncPointList
|
||||
// (
|
||||
// const polyMesh&,
|
||||
// UList<T>&,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
// );
|
||||
//
|
||||
// //- Synchronize values on selected mesh points.
|
||||
// template <class T, class CombineOp, class TransformOp>
|
||||
// static void syncPointList
|
||||
// (
|
||||
// const polyMesh&,
|
||||
// const labelList& meshPoints,
|
||||
// UList<T>&,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
// );
|
||||
//
|
||||
// //- Synchronize values on all mesh edges.
|
||||
// template <class T, class CombineOp, class TransformOp>
|
||||
// static void syncEdgeList
|
||||
// (
|
||||
// const polyMesh&,
|
||||
// UList<T>&,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
// );
|
||||
//
|
||||
//- Synchronize values on boundary faces only.
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
static void syncBoundaryFaceList
|
||||
@ -227,26 +216,20 @@ public:
|
||||
static void syncPointList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<T>& l,
|
||||
List<T>& l,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
syncPointList(mesh, l, cop, nullValue, transform());
|
||||
}
|
||||
);
|
||||
|
||||
//- Synchronize locations on all mesh points.
|
||||
template <class CombineOp>
|
||||
static void syncPointPositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<point>& l,
|
||||
List<point>& l,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
syncPointList(mesh, l, cop, nullValue, transformPosition());
|
||||
}
|
||||
);
|
||||
|
||||
//- Synchronize values on selected mesh points.
|
||||
template <class T, class CombineOp>
|
||||
@ -257,18 +240,7 @@ public:
|
||||
UList<T>& l,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
syncPointList
|
||||
(
|
||||
mesh,
|
||||
meshPoints,
|
||||
l,
|
||||
cop,
|
||||
nullValue,
|
||||
transform()
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
//- Synchronize locations on selected mesh points.
|
||||
template <class CombineOp>
|
||||
@ -279,18 +251,7 @@ public:
|
||||
UList<point>& l,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
syncPointList
|
||||
(
|
||||
mesh,
|
||||
meshPoints,
|
||||
l,
|
||||
cop,
|
||||
nullValue,
|
||||
transformPosition()
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Synchronise edge-wise data
|
||||
@ -303,10 +264,7 @@ public:
|
||||
UList<T>& l,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
syncEdgeList(mesh, l, cop, nullValue, transform());
|
||||
}
|
||||
);
|
||||
|
||||
//- Synchronize values on all mesh edges.
|
||||
template <class CombineOp>
|
||||
@ -316,10 +274,7 @@ public:
|
||||
UList<point>& l,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
syncEdgeList(mesh, l, cop, nullValue, transformPosition());
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// Synchronise face-wise data
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,8 +32,6 @@ License
|
||||
#include "transform.H"
|
||||
#include "transformList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Combine val with existing value at index
|
||||
@ -93,11 +91,6 @@ void Foam::syncTools::syncPointMap
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -398,11 +391,6 @@ void Foam::syncTools::syncEdgeMap
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Do synchronisation without constructing globalEdge addressing
|
||||
// (since this constructs mesh edge addressing)
|
||||
@ -767,14 +755,232 @@ void Foam::syncTools::syncEdgeMap
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
//template <class T, class CombineOp, class TransformOp>
|
||||
//void Foam::syncTools::syncPointList
|
||||
//(
|
||||
// const polyMesh& mesh,
|
||||
// UList<T>& pointValues,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
//)
|
||||
//{
|
||||
// if (pointValues.size() != mesh.nPoints())
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "syncTools<class T, class CombineOp>::syncPointList"
|
||||
// "(const polyMesh&, UList<T>&, const CombineOp&, const T&"
|
||||
// ", const bool)"
|
||||
// ) << "Number of values " << pointValues.size()
|
||||
// << " is not equal to the number of points in the mesh "
|
||||
// << mesh.nPoints() << abort(FatalError);
|
||||
// }
|
||||
//
|
||||
// const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
//
|
||||
//
|
||||
// if (Pstream::parRun())
|
||||
// {
|
||||
// PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
//
|
||||
// // Send
|
||||
//
|
||||
// forAll(patches, patchI)
|
||||
// {
|
||||
// if
|
||||
// (
|
||||
// isA<processorPolyPatch>(patches[patchI])
|
||||
// && patches[patchI].nPoints() > 0
|
||||
// )
|
||||
// {
|
||||
// const processorPolyPatch& procPatch =
|
||||
// refCast<const processorPolyPatch>(patches[patchI]);
|
||||
//
|
||||
// // Get data per patchPoint in neighbouring point numbers.
|
||||
// Field<T> patchInfo(procPatch.nPoints());
|
||||
//
|
||||
// const labelList& meshPts = procPatch.meshPoints();
|
||||
// const labelList& nbrPts = procPatch.neighbPoints();
|
||||
//
|
||||
// forAll(nbrPts, pointI)
|
||||
// {
|
||||
// label nbrPointI = nbrPts[pointI];
|
||||
// patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
// }
|
||||
//
|
||||
// UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
// toNbr << patchInfo;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// pBufs.finishedSends();
|
||||
//
|
||||
// // Receive and combine.
|
||||
//
|
||||
// forAll(patches, patchI)
|
||||
// {
|
||||
// if
|
||||
// (
|
||||
// isA<processorPolyPatch>(patches[patchI])
|
||||
// && patches[patchI].nPoints() > 0
|
||||
// )
|
||||
// {
|
||||
// const processorPolyPatch& procPatch =
|
||||
// refCast<const processorPolyPatch>(patches[patchI]);
|
||||
//
|
||||
// Field<T> nbrPatchInfo(procPatch.nPoints());
|
||||
// {
|
||||
// UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
// fromNbr >> nbrPatchInfo;
|
||||
// }
|
||||
//
|
||||
// // Transform to this side
|
||||
// top(procPatch, nbrPatchInfo);
|
||||
//
|
||||
// const labelList& meshPts = procPatch.meshPoints();
|
||||
//
|
||||
// forAll(meshPts, pointI)
|
||||
// {
|
||||
// label meshPointI = meshPts[pointI];
|
||||
// cop(pointValues[meshPointI], nbrPatchInfo[pointI]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Do the cyclics.
|
||||
// forAll(patches, patchI)
|
||||
// {
|
||||
// if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
// {
|
||||
// const cyclicPolyPatch& cycPatch =
|
||||
// refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
//
|
||||
// if (cycPatch.owner())
|
||||
// {
|
||||
// // Owner does all.
|
||||
//
|
||||
// const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
// const labelList& meshPts = cycPatch.meshPoints();
|
||||
// const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
// const labelList& nbrMeshPoints = nbrPatch.meshPoints();
|
||||
//
|
||||
// Field<T> half0Values(coupledPoints.size());
|
||||
// Field<T> half1Values(coupledPoints.size());
|
||||
//
|
||||
// forAll(coupledPoints, i)
|
||||
// {
|
||||
// const edge& e = coupledPoints[i];
|
||||
// half0Values[i] = pointValues[meshPts[e[0]]];
|
||||
// half1Values[i] = pointValues[nbrMeshPoints[e[1]]];
|
||||
// }
|
||||
//
|
||||
// //SubField<T> slice0(half0Values, half0Values.size());
|
||||
// //SubField<T> slice1(half1Values, half1Values.size());
|
||||
// //top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
// //top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
//
|
||||
// top(cycPatch, half1Values);
|
||||
// top(nbrPatch, half0Values);
|
||||
//
|
||||
// forAll(coupledPoints, i)
|
||||
// {
|
||||
// const edge& e = coupledPoints[i];
|
||||
// cop(pointValues[meshPts[e[0]]], half1Values[i]);
|
||||
// cop(pointValues[nbrMeshPoints[e[1]]], half0Values[i]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Synchronize multiple shared points.
|
||||
// const globalMeshData& pd = mesh.globalData();
|
||||
//
|
||||
// if (pd.nGlobalPoints() > 0)
|
||||
// {
|
||||
// // Values on shared points.
|
||||
// Field<T> sharedPts(pd.nGlobalPoints(), nullValue);
|
||||
//
|
||||
// forAll(pd.sharedPointLabels(), i)
|
||||
// {
|
||||
// label meshPointI = pd.sharedPointLabels()[i];
|
||||
// // Fill my entries in the shared points
|
||||
// sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI];
|
||||
// }
|
||||
//
|
||||
// // Combine on master.
|
||||
// Pstream::listCombineGather(sharedPts, cop);
|
||||
// Pstream::listCombineScatter(sharedPts);
|
||||
//
|
||||
// // Now we will all have the same information. Merge it back with
|
||||
// // my local information.
|
||||
// forAll(pd.sharedPointLabels(), i)
|
||||
// {
|
||||
// label meshPointI = pd.sharedPointLabels()[i];
|
||||
// pointValues[meshPointI] = sharedPts[pd.sharedPointAddr()[i]];
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
//template <class T, class CombineOp, class TransformOp>
|
||||
//void Foam::syncTools::syncPointList
|
||||
//(
|
||||
// const polyMesh& mesh,
|
||||
// const labelList& meshPoints,
|
||||
// UList<T>& pointValues,
|
||||
// const CombineOp& cop,
|
||||
// const T& nullValue,
|
||||
// const TransformOp& top
|
||||
//)
|
||||
//{
|
||||
// if (pointValues.size() != meshPoints.size())
|
||||
// {
|
||||
// FatalErrorIn
|
||||
// (
|
||||
// "syncTools<class T, class CombineOp>::syncPointList"
|
||||
// "(const polyMesh&, const labelList&, UList<T>&, const CombineOp&"
|
||||
// ", const T&, const bool)"
|
||||
// ) << "Number of values " << pointValues.size()
|
||||
// << " is not equal to the number of points "
|
||||
// << meshPoints.size() << abort(FatalError);
|
||||
// }
|
||||
//
|
||||
// if (!hasCouples(mesh.boundaryMesh()))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Field<T> meshValues(mesh.nPoints(), nullValue);
|
||||
//
|
||||
// forAll(meshPoints, i)
|
||||
// {
|
||||
// meshValues[meshPoints[i]] = pointValues[i];
|
||||
// }
|
||||
//
|
||||
// syncTools::syncPointList
|
||||
// (
|
||||
// mesh,
|
||||
// meshValues,
|
||||
// cop, // combine op
|
||||
// nullValue, // null value
|
||||
// top // position or field
|
||||
// );
|
||||
//
|
||||
// forAll(meshPoints, i)
|
||||
// {
|
||||
// pointValues[i] = meshValues[meshPoints[i]];
|
||||
// }
|
||||
//}
|
||||
|
||||
template <class T, class CombineOp>
|
||||
void Foam::syncTools::syncPointList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<T>& pointValues,
|
||||
List<T>& pointValues,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
if (pointValues.size() != mesh.nPoints())
|
||||
@ -782,173 +988,48 @@ void Foam::syncTools::syncPointList
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class T, class CombineOp>::syncPointList"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&"
|
||||
", const bool)"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)"
|
||||
) << "Number of values " << pointValues.size()
|
||||
<< " is not equal to the number of points in the mesh "
|
||||
<< mesh.nPoints() << abort(FatalError);
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nPoints() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
// Get data per patchPoint in neighbouring point numbers.
|
||||
Field<T> patchInfo(procPatch.nPoints());
|
||||
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
const labelList& nbrPts = procPatch.neighbPoints();
|
||||
|
||||
forAll(nbrPts, pointI)
|
||||
{
|
||||
label nbrPointI = nbrPts[pointI];
|
||||
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
}
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nPoints() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
Field<T> nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
// Transform to this side
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
|
||||
forAll(meshPts, pointI)
|
||||
{
|
||||
label meshPointI = meshPts[pointI];
|
||||
cop(pointValues[meshPointI], nbrPatchInfo[pointI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do the cyclics.
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
if (cycPatch.owner())
|
||||
{
|
||||
// Owner does all.
|
||||
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPts = cycPatch.meshPoints();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshPoints = nbrPatch.meshPoints();
|
||||
|
||||
Field<T> half0Values(coupledPoints.size());
|
||||
Field<T> half1Values(coupledPoints.size());
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
half0Values[i] = pointValues[meshPts[e[0]]];
|
||||
half1Values[i] = pointValues[nbrMeshPoints[e[1]]];
|
||||
}
|
||||
|
||||
//SubField<T> slice0(half0Values, half0Values.size());
|
||||
//SubField<T> slice1(half1Values, half1Values.size());
|
||||
//top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
cop(pointValues[meshPts[e[0]]], half1Values[i]);
|
||||
cop(pointValues[nbrMeshPoints[e[1]]], half0Values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronize multiple shared points.
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
|
||||
if (pd.nGlobalPoints() > 0)
|
||||
{
|
||||
// Values on shared points.
|
||||
Field<T> sharedPts(pd.nGlobalPoints(), nullValue);
|
||||
|
||||
forAll(pd.sharedPointLabels(), i)
|
||||
{
|
||||
label meshPointI = pd.sharedPointLabels()[i];
|
||||
// Fill my entries in the shared points
|
||||
sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI];
|
||||
}
|
||||
|
||||
// Combine on master.
|
||||
Pstream::listCombineGather(sharedPts, cop);
|
||||
Pstream::listCombineScatter(sharedPts);
|
||||
|
||||
// Now we will all have the same information. Merge it back with
|
||||
// my local information.
|
||||
forAll(pd.sharedPointLabels(), i)
|
||||
{
|
||||
label meshPointI = pd.sharedPointLabels()[i];
|
||||
pointValues[meshPointI] = sharedPts[pd.sharedPointAddr()[i]];
|
||||
}
|
||||
}
|
||||
mesh.globalData().syncPointData(pointValues, cop, false);
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
template <class CombineOp>
|
||||
void Foam::syncTools::syncPointPositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
List<point>& pointValues,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
if (pointValues.size() != mesh.nPoints())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class CombineOp>::syncPointPositions"
|
||||
"(const polyMesh&, List<point>&, const CombineOp&, const point&)"
|
||||
) << "Number of values " << pointValues.size()
|
||||
<< " is not equal to the number of points in the mesh "
|
||||
<< mesh.nPoints() << abort(FatalError);
|
||||
}
|
||||
|
||||
mesh.globalData().syncPointData(pointValues, cop, true);
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp>
|
||||
void Foam::syncTools::syncPointList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& meshPoints,
|
||||
UList<T>& pointValues,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
if (pointValues.size() != meshPoints.size())
|
||||
@ -956,49 +1037,116 @@ void Foam::syncTools::syncPointList
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class T, class CombineOp>::syncPointList"
|
||||
"(const polyMesh&, const labelList&, UList<T>&, const CombineOp&"
|
||||
", const T&, const bool)"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)"
|
||||
) << "Number of values " << pointValues.size()
|
||||
<< " is not equal to the number of points "
|
||||
<< " is not equal to the number of meshPoints "
|
||||
<< meshPoints.size() << abort(FatalError);
|
||||
}
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const indirectPrimitivePatch& cpp = gd.coupledPatch();
|
||||
const Map<label>& mpm = cpp.meshPointMap();
|
||||
|
||||
if (!hasCouples(mesh.boundaryMesh()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Field<T> meshValues(mesh.nPoints(), nullValue);
|
||||
List<T> cppFld(cpp.nPoints(), nullValue);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
meshValues[meshPoints[i]] = pointValues[i];
|
||||
label pointI = meshPoints[i];
|
||||
Map<label>::const_iterator iter = mpm.find(pointI);
|
||||
if (iter != mpm.end())
|
||||
{
|
||||
cppFld[iter()] = pointValues[i];
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncPointList
|
||||
globalMeshData::syncData
|
||||
(
|
||||
mesh,
|
||||
meshValues,
|
||||
cop, // combine op
|
||||
nullValue, // null value
|
||||
top // position or field
|
||||
cppFld,
|
||||
gd.globalPointSlaves(),
|
||||
gd.globalPointTransformedSlaves(),
|
||||
gd.globalPointSlavesMap(),
|
||||
gd.globalTransforms(),
|
||||
cop,
|
||||
false //position?
|
||||
);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
pointValues[i] = meshValues[meshPoints[i]];
|
||||
label pointI = meshPoints[i];
|
||||
Map<label>::const_iterator iter = mpm.find(pointI);
|
||||
if (iter != mpm.end())
|
||||
{
|
||||
pointValues[i] = cppFld[iter()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp, class TransformOp>
|
||||
template <class CombineOp>
|
||||
void Foam::syncTools::syncPointPositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const labelList& meshPoints,
|
||||
UList<point>& pointValues,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
if (pointValues.size() != meshPoints.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class CombineOp>::syncPointList"
|
||||
"(const polyMesh&, UList<point>&, const CombineOp&, const point&)"
|
||||
) << "Number of values " << pointValues.size()
|
||||
<< " is not equal to the number of meshPoints "
|
||||
<< meshPoints.size() << abort(FatalError);
|
||||
}
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const indirectPrimitivePatch& cpp = gd.coupledPatch();
|
||||
const Map<label>& mpm = cpp.meshPointMap();
|
||||
|
||||
List<point> cppFld(cpp.nPoints(), nullValue);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
label pointI = meshPoints[i];
|
||||
Map<label>::const_iterator iter = mpm.find(pointI);
|
||||
if (iter != mpm.end())
|
||||
{
|
||||
cppFld[iter()] = pointValues[i];
|
||||
}
|
||||
}
|
||||
|
||||
globalMeshData::syncData
|
||||
(
|
||||
cppFld,
|
||||
gd.globalPointSlaves(),
|
||||
gd.globalPointTransformedSlaves(),
|
||||
gd.globalPointSlavesMap(),
|
||||
gd.globalTransforms(),
|
||||
cop,
|
||||
true //position?
|
||||
);
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
label pointI = meshPoints[i];
|
||||
Map<label>::const_iterator iter = mpm.find(pointI);
|
||||
if (iter != mpm.end())
|
||||
{
|
||||
pointValues[i] = cppFld[iter()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class T, class CombineOp>
|
||||
void Foam::syncTools::syncEdgeList
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<T>& edgeValues,
|
||||
const CombineOp& cop,
|
||||
const T& nullValue,
|
||||
const TransformOp& top
|
||||
const T& nullValue
|
||||
)
|
||||
{
|
||||
if (edgeValues.size() != mesh.nEdges())
|
||||
@ -1006,168 +1154,78 @@ void Foam::syncTools::syncEdgeList
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class T, class CombineOp>::syncEdgeList"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&"
|
||||
", const bool)"
|
||||
"(const polyMesh&, UList<T>&, const CombineOp&, const T&)"
|
||||
) << "Number of values " << edgeValues.size()
|
||||
<< " is not equal to the number of edges in the mesh "
|
||||
<< mesh.nEdges() << abort(FatalError);
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const labelList& meshEdges = gd.coupledPatchMeshEdges();
|
||||
const globalIndexAndTransform& git = gd.globalTransforms();
|
||||
const mapDistribute& edgeMap = gd.globalEdgeSlavesMap();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
List<T> cppFld(UIndirectList<T>(edgeValues, meshEdges));
|
||||
|
||||
globalMeshData::syncData
|
||||
(
|
||||
cppFld,
|
||||
gd.globalEdgeSlaves(),
|
||||
gd.globalEdgeTransformedSlaves(),
|
||||
edgeMap,
|
||||
git,
|
||||
cop,
|
||||
false //position?
|
||||
);
|
||||
|
||||
// Extract back onto mesh
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
return;
|
||||
edgeValues[meshEdges[i]] = cppFld[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class CombineOp>
|
||||
void Foam::syncTools::syncEdgePositions
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
UList<point>& edgeValues,
|
||||
const CombineOp& cop,
|
||||
const point& nullValue
|
||||
)
|
||||
{
|
||||
if (edgeValues.size() != mesh.nEdges())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"syncTools<class CombineOp>::syncEdgePositions"
|
||||
"(const polyMesh&, UList<point>&, const CombineOp&, const point&)"
|
||||
) << "Number of values " << edgeValues.size()
|
||||
<< " is not equal to the number of edges in the mesh "
|
||||
<< mesh.nEdges() << abort(FatalError);
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const labelList& meshEdges = gd.coupledPatchMeshEdges();
|
||||
|
||||
List<point> cppFld(UIndirectList<point>(edgeValues, meshEdges));
|
||||
|
||||
globalMeshData::syncData
|
||||
(
|
||||
cppFld,
|
||||
gd.globalEdgeSlaves(),
|
||||
gd.globalEdgeTransformedSlaves(),
|
||||
gd.globalEdgeSlavesMap(),
|
||||
gd.globalTransforms(),
|
||||
cop,
|
||||
true //position?
|
||||
);
|
||||
|
||||
// Extract back onto mesh
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nEdges() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
const labelList& neighbEdges = procPatch.neighbEdges();
|
||||
|
||||
// Get region per patch edge in neighbouring edge numbers.
|
||||
Field<T> patchInfo(procPatch.nEdges(), nullValue);
|
||||
|
||||
forAll(neighbEdges, edgeI)
|
||||
{
|
||||
label nbrEdgeI = neighbEdges[edgeI];
|
||||
|
||||
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
|
||||
}
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nEdges() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
|
||||
// Receive from neighbour. Is per patch edge the region of the
|
||||
// neighbouring patch edge.
|
||||
Field<T> nbrPatchInfo(procPatch.nEdges());
|
||||
|
||||
{
|
||||
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
// Transform to this side
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
forAll(meshEdges, edgeI)
|
||||
{
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
cop(edgeValues[meshEdgeI], nbrPatchInfo[edgeI]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do the cyclics.
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
if (cycPatch.owner())
|
||||
{
|
||||
// Owner does all.
|
||||
const edgeList& coupledEdges = cycPatch.coupledEdges();
|
||||
const labelList& meshEdges = cycPatch.meshEdges();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshEdges = nbrPatch.meshEdges();
|
||||
|
||||
Field<T> half0Values(coupledEdges.size());
|
||||
Field<T> half1Values(coupledEdges.size());
|
||||
|
||||
forAll(coupledEdges, i)
|
||||
{
|
||||
const edge& e = coupledEdges[i];
|
||||
half0Values[i] = edgeValues[meshEdges[e[0]]];
|
||||
half1Values[i] = edgeValues[nbrMeshEdges[e[1]]];
|
||||
}
|
||||
|
||||
//SubField<T> slice0(half0Values, half0Values.size());
|
||||
//SubField<T> slice1(half1Values, half1Values.size());
|
||||
//top(cycPatch, reinterpret_cast<Field<T>&>(slice1));
|
||||
//top(nbrPatch, reinterpret_cast<Field<T>&>(slice0));
|
||||
|
||||
top(cycPatch, half1Values);
|
||||
top(nbrPatch, half0Values);
|
||||
|
||||
forAll(coupledEdges, i)
|
||||
{
|
||||
const edge& e = coupledEdges[i];
|
||||
cop(edgeValues[meshEdges[e[0]]], half1Values[i]);
|
||||
cop(edgeValues[nbrMeshEdges[e[1]]], half0Values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- Note: hasTransformation is only used for warning messages so
|
||||
// reduction not strictly nessecary.
|
||||
//reduce(hasTransformation, orOp<bool>());
|
||||
|
||||
// Do the multiple shared edges
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
|
||||
if (pd.nGlobalEdges() > 0)
|
||||
{
|
||||
// Values on shared edges.
|
||||
Field<T> sharedPts(pd.nGlobalEdges(), nullValue);
|
||||
|
||||
forAll(pd.sharedEdgeLabels(), i)
|
||||
{
|
||||
label meshEdgeI = pd.sharedEdgeLabels()[i];
|
||||
|
||||
// Fill my entries in the shared edges
|
||||
sharedPts[pd.sharedEdgeAddr()[i]] = edgeValues[meshEdgeI];
|
||||
}
|
||||
|
||||
// Combine on master.
|
||||
Pstream::listCombineGather(sharedPts, cop);
|
||||
Pstream::listCombineScatter(sharedPts);
|
||||
|
||||
// Now we will all have the same information. Merge it back with
|
||||
// my local information.
|
||||
forAll(pd.sharedEdgeLabels(), i)
|
||||
{
|
||||
label meshEdgeI = pd.sharedEdgeLabels()[i];
|
||||
edgeValues[meshEdgeI] = sharedPts[pd.sharedEdgeAddr()[i]];
|
||||
}
|
||||
edgeValues[meshEdges[i]] = cppFld[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1197,12 +1255,6 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -1223,13 +1275,7 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
label patchStart = procPatch.start()-mesh.nInternalFaces();
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr <<
|
||||
SubField<T>
|
||||
(
|
||||
faceValues,
|
||||
procPatch.size(),
|
||||
patchStart
|
||||
);
|
||||
toNbr << SubField<T>(faceValues, procPatch.size(), patchStart);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1331,11 +1377,6 @@ void Foam::syncTools::syncFaceList
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -1466,11 +1507,6 @@ void Foam::syncTools::syncPointList
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -1630,11 +1666,6 @@ void Foam::syncTools::syncEdgeList
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
if (!hasCouples(patches))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,19 +27,26 @@ Typedef
|
||||
Description
|
||||
Label pair
|
||||
|
||||
Typedef
|
||||
Foam::labelPairList
|
||||
|
||||
Description
|
||||
List of labelPairs
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef labelPair_H
|
||||
#define labelPair_H
|
||||
|
||||
#include "label.H"
|
||||
#include "Pair.H"
|
||||
#include "List.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef Pair<label> labelPair;
|
||||
typedef List<labelPair> labelPairList;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -288,6 +288,19 @@ void Foam::globalIndexAndTransform::determineTransforms()
|
||||
}
|
||||
|
||||
Pstream::scatter(transforms_);
|
||||
|
||||
if (transforms_.size() > 3)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"void globalIndexAndTransform::determineTransforms()"
|
||||
) << "More than three independent basic "
|
||||
<< "transforms detected:" << nl
|
||||
<< transforms_ << nl
|
||||
<< "This is not a space filling tiling and will probably"
|
||||
<< " give problems for e.g. lagrangian tracking or interpolation"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -324,6 +337,11 @@ void Foam::globalIndexAndTransform::determineTransformPermutations()
|
||||
|
||||
transformPermutations_[tPI] = transform;
|
||||
}
|
||||
|
||||
|
||||
// Encode index for 0 sign
|
||||
labelList permutationIndices(nIndependentTransforms(), 0);
|
||||
nullTransformIndex_ = encodeTransformIndex(permutationIndices);
|
||||
}
|
||||
|
||||
|
||||
@ -463,6 +481,7 @@ Foam::globalIndexAndTransform::globalIndexAndTransform
|
||||
determinePatchTransformSign();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::globalIndexAndTransform::~globalIndexAndTransform()
|
||||
@ -42,11 +42,9 @@ SourceFiles
|
||||
#ifndef globalIndexAndTransform_H
|
||||
#define globalIndexAndTransform_H
|
||||
|
||||
#include "Pstream.H"
|
||||
#include "List.H"
|
||||
#include "labelPair.H"
|
||||
#include "vectorTensorTransform.H"
|
||||
#include "polyMesh.H"
|
||||
#include "HashSet.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -82,6 +80,9 @@ class globalIndexAndTransform
|
||||
// transform.
|
||||
List<vectorTensorTransform> transformPermutations_;
|
||||
|
||||
//- Index of identity transform.
|
||||
label nullTransformIndex_;
|
||||
|
||||
//- Mapping from patch index to which transform it matches (or
|
||||
// -1 for none) (.first()) and what sign to use for it,
|
||||
// i.e. +/- 1 (.second()).
|
||||
@ -93,6 +94,7 @@ class globalIndexAndTransform
|
||||
//- Number of spaces to reserve for transform encoding
|
||||
static const label base_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Determine all of the independent basic transforms of the
|
||||
@ -118,6 +120,12 @@ class globalIndexAndTransform
|
||||
bool checkBothSigns
|
||||
) const;
|
||||
|
||||
//- Decode transform index. Hardcoded to 3 independent transforms max.
|
||||
inline static FixedList<label, 3> decodeTransformIndex
|
||||
(
|
||||
const label transformIndex
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
globalIndexAndTransform(const globalIndexAndTransform&);
|
||||
|
||||
@ -147,15 +155,39 @@ public:
|
||||
const List<label>& permutationIndices
|
||||
) const;
|
||||
|
||||
//- Add patch transformation to transformIndex. Return new
|
||||
// transformIndex. (by default the patch is the sending, not the
|
||||
// receiving, patch)
|
||||
inline label addToTransformIndex
|
||||
(
|
||||
const label transformIndex,
|
||||
const label patchI,
|
||||
const bool isSendingSide = true
|
||||
) const;
|
||||
|
||||
//- Combine two transformIndices
|
||||
static inline label mergeTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
);
|
||||
|
||||
//- Combine two transformIndices
|
||||
static inline label minimumTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
);
|
||||
|
||||
//- Encode index and bare index as components on own processor
|
||||
inline labelPair encode
|
||||
inline static labelPair encode
|
||||
(
|
||||
const label index,
|
||||
const label transformIndex
|
||||
);
|
||||
|
||||
//- Encode index and bare index as components on given processor
|
||||
inline labelPair encode
|
||||
inline static labelPair encode
|
||||
(
|
||||
const label procI,
|
||||
const label index,
|
||||
@ -163,13 +195,16 @@ public:
|
||||
);
|
||||
|
||||
//- Index carried by the object
|
||||
inline label index(const labelPair& globalIAndTransform);
|
||||
inline static label index(const labelPair& globalIAndTransform);
|
||||
|
||||
//- Which processor does this come from?
|
||||
inline label processor(const labelPair& globalIAndTransform);
|
||||
inline static label processor(const labelPair& globalIAndTransform);
|
||||
|
||||
//- Transform carried by the object
|
||||
inline label transformIndex(const labelPair& globalIAndTransform);
|
||||
inline static label transformIndex
|
||||
(
|
||||
const labelPair& globalIAndTransform
|
||||
);
|
||||
|
||||
// Access
|
||||
|
||||
@ -183,6 +218,10 @@ public:
|
||||
inline const List<vectorTensorTransform>&
|
||||
transformPermutations() const;
|
||||
|
||||
//- Return the transformIndex (index in transformPermutations)
|
||||
// of the identity transform
|
||||
inline label nullTransformIndex() const;
|
||||
|
||||
//- Return access to the per-patch transform-sign pairs
|
||||
inline const List<Pair<label> >& patchTransformSign() const;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,8 +23,9 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::encodeTransformIndex
|
||||
(
|
||||
@ -74,6 +75,210 @@ Foam::label Foam::globalIndexAndTransform::encodeTransformIndex
|
||||
}
|
||||
|
||||
|
||||
Foam::FixedList<Foam::label, 3>
|
||||
Foam::globalIndexAndTransform::decodeTransformIndex
|
||||
(
|
||||
const label transformIndex
|
||||
)
|
||||
{
|
||||
FixedList<label, 3> permutation;
|
||||
|
||||
label t = transformIndex;
|
||||
permutation[0] = (t%3)-1;
|
||||
t /= 3;
|
||||
permutation[1] = (t%3)-1;
|
||||
t /= 3;
|
||||
permutation[2] = (t%3)-1;
|
||||
|
||||
# ifdef FULLDEBUG
|
||||
t /= 3;
|
||||
if (t != 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"globalIndexAndTransform::decodeTransformIndex(const label)"
|
||||
) << "transformIndex : " << transformIndex
|
||||
<< " has more than 3 fields."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
# endif
|
||||
|
||||
return permutation;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::addToTransformIndex
|
||||
(
|
||||
const label transformIndex,
|
||||
const label patchI,
|
||||
const bool isSendingSide
|
||||
) const
|
||||
{
|
||||
const Pair<label>& transSign = patchTransformSign_[patchI];
|
||||
|
||||
label matchTransI = transSign.first();
|
||||
|
||||
// Hardcoded for max 3 transforms only!
|
||||
|
||||
if (matchTransI > -1 && matchTransI < 3)
|
||||
{
|
||||
FixedList<label, 3> permutation = decodeTransformIndex(transformIndex);
|
||||
|
||||
|
||||
// Add patch transform
|
||||
// ~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
label sign = transSign.second();
|
||||
if (!isSendingSide)
|
||||
{
|
||||
sign = -sign;
|
||||
}
|
||||
|
||||
|
||||
// If this transform been found already by a patch?
|
||||
if (permutation[matchTransI] != 0)
|
||||
{
|
||||
if (sign == 0)
|
||||
{
|
||||
// sent from patch without a transformation. Do nothing.
|
||||
FatalErrorIn("globalIndexAndTransform::addToTransformIndex(..)")
|
||||
<< "patch:" << mesh_.boundaryMesh()[patchI].name()
|
||||
<< " transform:" << matchTransI << " sign:" << sign
|
||||
<< " current transforms:" << permutation
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else if (sign == permutation[matchTransI])
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::label "
|
||||
"Foam::globalIndexAndTransform::addToTransformIndex\n"
|
||||
"(\n"
|
||||
"const label,\n"
|
||||
"const label,\n"
|
||||
"const bool\n"
|
||||
") const\n"
|
||||
) << "More than one patch accessing the same transform "
|
||||
<< "but not of the same sign." << endl
|
||||
<< "patch:" << mesh_.boundaryMesh()[patchI].name()
|
||||
<< " transform:" << matchTransI << " sign:" << sign
|
||||
<< " current transforms:" << permutation
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
permutation[matchTransI] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
permutation[matchTransI] = sign;
|
||||
}
|
||||
|
||||
|
||||
// Re-encode permutation
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
return
|
||||
(permutation[2]+1)*9
|
||||
+ (permutation[1]+1)*3
|
||||
+ (permutation[0]+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return transformIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::mergeTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
)
|
||||
{
|
||||
FixedList<label, 3> permutation0 = decodeTransformIndex(transformIndex0);
|
||||
FixedList<label, 3> permutation1 = decodeTransformIndex(transformIndex1);
|
||||
|
||||
forAll(permutation0, i)
|
||||
{
|
||||
if (permutation0[i] == 0)
|
||||
{
|
||||
// Take over whatever sign 1 has
|
||||
permutation0[i] = permutation1[i];
|
||||
}
|
||||
else if (permutation1[i] != 0 && permutation0[i] != permutation1[i])
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::label "
|
||||
"Foam::globalIndexAndTransform::addToTransformIndex\n"
|
||||
"(\n"
|
||||
"const label,\n"
|
||||
"const label\n"
|
||||
") const\n"
|
||||
) << "More than one patch accessing the same transform "
|
||||
<< "but not of the same sign." << endl
|
||||
<< "Trying to combine two transforms " << transformIndex0
|
||||
<< " with signs " << permutation0
|
||||
<< " and " << transformIndex1
|
||||
<< " with signs " << permutation1
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return
|
||||
(permutation0[2]+1)*9
|
||||
+ (permutation0[1]+1)*3
|
||||
+ (permutation0[0]+1);
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::minimumTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
)
|
||||
{
|
||||
FixedList<label, 3> permutation0 = decodeTransformIndex(transformIndex0);
|
||||
FixedList<label, 3> permutation1 = decodeTransformIndex(transformIndex1);
|
||||
|
||||
forAll(permutation0, i)
|
||||
{
|
||||
if (permutation0[i] == 0)
|
||||
{
|
||||
// 0 wins.
|
||||
}
|
||||
else if (permutation1[i] == 0)
|
||||
{
|
||||
// 0 wins.
|
||||
permutation0[i] = permutation1[i];
|
||||
}
|
||||
else if (permutation0[i] != permutation1[i])
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::label "
|
||||
"Foam::globalIndexAndTransform::minimumTransformIndex\n"
|
||||
"(\n"
|
||||
"const label,\n"
|
||||
"const label\n"
|
||||
") const\n"
|
||||
) << "More than one patch accessing the same transform "
|
||||
<< "but not of the same sign." << endl
|
||||
<< "Trying to combine two transforms " << transformIndex0
|
||||
<< " with signs " << permutation0
|
||||
<< " and " << transformIndex1
|
||||
<< " with signs " << permutation1
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return
|
||||
(permutation0[2]+1)*9
|
||||
+ (permutation0[1]+1)*3
|
||||
+ (permutation0[0]+1);
|
||||
}
|
||||
|
||||
|
||||
Foam::labelPair Foam::globalIndexAndTransform::encode
|
||||
(
|
||||
const label index,
|
||||
@ -133,7 +338,7 @@ Foam::labelPair Foam::globalIndexAndTransform::encode
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::index
|
||||
Foam::label Foam::globalIndexAndTransform::index
|
||||
(
|
||||
const labelPair& globalIAndTransform
|
||||
)
|
||||
@ -180,6 +385,12 @@ Foam::globalIndexAndTransform::transformPermutations() const
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::nullTransformIndex() const
|
||||
{
|
||||
return nullTransformIndex_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::List<Foam::Pair<Foam::label> >&
|
||||
Foam::globalIndexAndTransform::patchTransformSign() const
|
||||
{
|
||||
@ -399,7 +610,10 @@ Foam::pointField Foam::globalIndexAndTransform::transformPatches
|
||||
|
||||
forAll(transIs, tII)
|
||||
{
|
||||
transPts[tII] = transformPermutations_[transIs[tII]].transform(pt);
|
||||
transPts[tII] = transformPermutations_[transIs[tII]].transformPosition
|
||||
(
|
||||
pt
|
||||
);
|
||||
}
|
||||
|
||||
return transPts;
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,7 +56,7 @@ Foam::vectorTensorTransform::vectorTensorTransform(Istream& is)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::word Foam::name(const vectorTensorTransform& s)
|
||||
{
|
||||
@ -68,6 +68,32 @@ Foam::word Foam::name(const vectorTensorTransform& s)
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::Field<bool> > Foam::vectorTensorTransform::transform
|
||||
(
|
||||
const Field<bool>& fld
|
||||
) const
|
||||
{
|
||||
return fld;
|
||||
}
|
||||
template<>
|
||||
Foam::tmp<Foam::Field<Foam::label> > Foam::vectorTensorTransform::transform
|
||||
(
|
||||
const Field<label>& fld
|
||||
) const
|
||||
{
|
||||
return fld;
|
||||
}
|
||||
template<>
|
||||
Foam::tmp<Foam::Field<Foam::scalar> > Foam::vectorTensorTransform::transform
|
||||
(
|
||||
const Field<scalar>& fld
|
||||
) const
|
||||
{
|
||||
return fld;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, vectorTensorTransform& tr)
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,13 +31,13 @@ Description
|
||||
SourceFiles
|
||||
vectorTensorTransformI.H
|
||||
vectorTensorTransform.C
|
||||
vectorTensorTransformTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef vectorTensorTransform_H
|
||||
#define vectorTensorTransform_H
|
||||
|
||||
#include "vector.H"
|
||||
#include "tensor.H"
|
||||
#include "word.H"
|
||||
#include "contiguous.H"
|
||||
@ -132,17 +132,21 @@ public:
|
||||
|
||||
// Transform
|
||||
|
||||
//- Transform the given vector
|
||||
inline vector transform(const vector& v) const;
|
||||
//- Transform the given position
|
||||
inline vector transformPosition(const vector& v) const;
|
||||
|
||||
//- Transform the given pointField
|
||||
inline pointField transform(const pointField& pts) const;
|
||||
inline pointField transformPosition(const pointField& pts) const;
|
||||
|
||||
//- Inverse transform the given vector
|
||||
inline vector invTransform(const vector& v) const;
|
||||
//- Inverse transform the given position
|
||||
inline vector invTransformPosition(const vector& v) const;
|
||||
|
||||
//- Inverse transform the given pointField
|
||||
inline pointField invTransform(const pointField& pts) const;
|
||||
inline pointField invTransformPosition(const pointField& pts) const;
|
||||
|
||||
//- Transform the given field
|
||||
template<class Type>
|
||||
tmp<Field<Type> > transform(const Field<Type>&) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
@ -180,6 +184,15 @@ word name(const vectorTensorTransform&);
|
||||
template<>
|
||||
inline bool contiguous<vectorTensorTransform>() {return true;}
|
||||
|
||||
//- Template specialisations
|
||||
template<>
|
||||
tmp<Field<bool> > vectorTensorTransform::transform(const Field<bool>&) const;
|
||||
template<>
|
||||
tmp<Field<label> > vectorTensorTransform::transform(const Field<label>&) const;
|
||||
template<>
|
||||
tmp<Field<scalar> > vectorTensorTransform::transform(const Field<scalar>&)
|
||||
const;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||
|
||||
@ -234,6 +247,10 @@ inline vectorTensorTransform operator&
|
||||
|
||||
#include "vectorTensorTransformI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "vectorTensorTransformTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -99,7 +99,7 @@ inline Foam::tensor& Foam::vectorTensorTransform::R()
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vector Foam::vectorTensorTransform::transform
|
||||
inline Foam::vector Foam::vectorTensorTransform::transformPosition
|
||||
(
|
||||
const vector& v
|
||||
) const
|
||||
@ -115,7 +115,7 @@ inline Foam::vector Foam::vectorTensorTransform::transform
|
||||
}
|
||||
|
||||
|
||||
inline Foam::pointField Foam::vectorTensorTransform::transform
|
||||
inline Foam::pointField Foam::vectorTensorTransform::transformPosition
|
||||
(
|
||||
const pointField& pts
|
||||
) const
|
||||
@ -134,7 +134,7 @@ inline Foam::pointField Foam::vectorTensorTransform::transform
|
||||
}
|
||||
|
||||
|
||||
inline Foam::vector Foam::vectorTensorTransform::invTransform
|
||||
inline Foam::vector Foam::vectorTensorTransform::invTransformPosition
|
||||
(
|
||||
const vector& v
|
||||
) const
|
||||
@ -150,7 +150,7 @@ inline Foam::vector Foam::vectorTensorTransform::invTransform
|
||||
}
|
||||
|
||||
|
||||
inline Foam::pointField Foam::vectorTensorTransform::invTransform
|
||||
inline Foam::pointField Foam::vectorTensorTransform::invTransformPosition
|
||||
(
|
||||
const pointField& pts
|
||||
) const
|
||||
@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::vectorTensorTransform::transform
|
||||
(
|
||||
const Field<Type>& fld
|
||||
) const
|
||||
{
|
||||
if (hasR_)
|
||||
{
|
||||
return R() & fld;
|
||||
}
|
||||
else
|
||||
{
|
||||
return fld;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -33,8 +33,10 @@ static const char* notImplementedMessage =
|
||||
"\n"
|
||||
"Please install metis and make sure that libmetis.so is in your "
|
||||
"LD_LIBRARY_PATH.\n"
|
||||
"The metisDecomp library can then be built in "
|
||||
"$FOAM_SRC/parallel/decompose/decompositionMethods/metisDecomp\n";
|
||||
"The metisDecomp library can then be built from "
|
||||
"$FOAM_SRC/parallel/decompose/metisDecomp and dynamically loading or linking"
|
||||
" this library will add metis as a decomposition method.\n"
|
||||
"Please be aware that there are license restrictions on using Metis.";
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -60,6 +60,7 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str)
|
||||
|
||||
Foam::label Foam::ptscotchDecomp::decomposeZeroDomains
|
||||
(
|
||||
const fileName& meshPath,
|
||||
const List<int>& initxadj,
|
||||
const List<int>& initadjncy,
|
||||
const scalarField& initcWeights,
|
||||
@ -82,6 +83,7 @@ Foam::label Foam::ptscotchDecomp::decomposeZeroDomains
|
||||
}
|
||||
Foam::label Foam::ptscotchDecomp::decompose
|
||||
(
|
||||
const fileName& meshPath,
|
||||
const List<int>& adjncy,
|
||||
const List<int>& xadj,
|
||||
const scalarField& cWeights,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -104,8 +104,7 @@ Foam::labelListList Foam::addPatchCellLayer::calcGlobalEdgeFaces
|
||||
mesh,
|
||||
globalEdgeFaces,
|
||||
uniqueEqOp(),
|
||||
labelList(), // null value
|
||||
Foam::dummyTransform() // dummy transform
|
||||
labelList() // null value
|
||||
);
|
||||
|
||||
// Extract pp part
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -4394,7 +4394,7 @@ void Foam::hexRef8::distribute(const mapDistributePolyMesh& map)
|
||||
|
||||
void Foam::hexRef8::checkMesh() const
|
||||
{
|
||||
const scalar smallDim = 1E-6 * mesh_.globalData().bb().mag();
|
||||
const scalar smallDim = 1E-6 * mesh_.bounds().mag();
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -342,8 +342,6 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::readSamplePoints()
|
||||
localVertices2D[i][1] = localVertices[i][1];
|
||||
}
|
||||
|
||||
triSurface s(triSurfaceTools::delaunay2D(localVertices2D));
|
||||
|
||||
tmp<pointField> localFaceCentres
|
||||
(
|
||||
referenceCS().localPosition
|
||||
@ -352,6 +350,26 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::readSamplePoints()
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
OFstream str
|
||||
(
|
||||
this->db().time().path()/this->patch().name()
|
||||
+ "_localFaceCentres.obj"
|
||||
);
|
||||
Pout<< "readSamplePoints :"
|
||||
<< " Dumping face centres to " << str.name() << endl;
|
||||
|
||||
forAll(localFaceCentres(), i)
|
||||
{
|
||||
const point& p = localFaceCentres()[i];
|
||||
str<< "v " << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
triSurface s(triSurfaceTools::delaunay2D(localVertices2D));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "readSamplePoints :"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -155,8 +155,8 @@ void Foam::cellPointWeight::findTriangle
|
||||
List<tetIndices> faceTets = polyMeshTetDecomposition::faceTetIndices
|
||||
(
|
||||
mesh,
|
||||
mesh.faceOwner()[faceI],
|
||||
faceI
|
||||
faceI,
|
||||
mesh.faceOwner()[faceI]
|
||||
);
|
||||
|
||||
const scalar faceAreaSqr = magSqr(mesh.faceAreas()[faceI]);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,6 +39,104 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void volPointInterpolation::syncUntransformedData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
) const
|
||||
{
|
||||
// Transfer onto coupled patch
|
||||
const globalMeshData& gmd = mesh().globalData();
|
||||
const indirectPrimitivePatch& cpp = gmd.coupledPatch();
|
||||
const labelList& meshPoints = cpp.meshPoints();
|
||||
|
||||
const mapDistribute& slavesMap = gmd.globalPointSlavesMap();
|
||||
const labelListList& slaves = gmd.globalPointSlaves();
|
||||
|
||||
List<Type> elems(slavesMap.constructSize());
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
elems[i] = pointData[meshPoints[i]];
|
||||
}
|
||||
|
||||
// Pull slave data onto master. No need to update transformed slots.
|
||||
slavesMap.distribute(elems, false);
|
||||
|
||||
// Combine master data with slave data
|
||||
forAll(slaves, i)
|
||||
{
|
||||
Type& elem = elems[i];
|
||||
|
||||
const labelList& slavePoints = slaves[i];
|
||||
|
||||
// Combine master with untransformed slave data
|
||||
forAll(slavePoints, j)
|
||||
{
|
||||
cop(elem, elems[slavePoints[j]]);
|
||||
}
|
||||
|
||||
// Copy result back to slave slots
|
||||
forAll(slavePoints, j)
|
||||
{
|
||||
elems[slavePoints[j]] = elem;
|
||||
}
|
||||
}
|
||||
|
||||
// Push slave-slot data back to slaves
|
||||
slavesMap.reverseDistribute(elems.size(), elems, false);
|
||||
|
||||
// Extract back onto mesh
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
pointData[meshPoints[i]] = elems[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void volPointInterpolation::pushUntransformedData
|
||||
(
|
||||
List<Type>& pointData
|
||||
) const
|
||||
{
|
||||
// Transfer onto coupled patch
|
||||
const globalMeshData& gmd = mesh().globalData();
|
||||
const indirectPrimitivePatch& cpp = gmd.coupledPatch();
|
||||
const labelList& meshPoints = cpp.meshPoints();
|
||||
|
||||
const mapDistribute& slavesMap = gmd.globalPointSlavesMap();
|
||||
const labelListList& slaves = gmd.globalPointSlaves();
|
||||
|
||||
List<Type> elems(slavesMap.constructSize());
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
elems[i] = pointData[meshPoints[i]];
|
||||
}
|
||||
|
||||
// Combine master data with slave data
|
||||
forAll(slaves, i)
|
||||
{
|
||||
const labelList& slavePoints = slaves[i];
|
||||
|
||||
// Copy master data to slave slots
|
||||
forAll(slaves, j)
|
||||
{
|
||||
elems[slavePoints[j]] = elems[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Push slave-slot data back to slaves
|
||||
slavesMap.reverseDistribute(elems.size(), elems, false);
|
||||
|
||||
// Extract back onto mesh
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
pointData[meshPoints[i]] = elems[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void volPointInterpolation::addSeparated
|
||||
(
|
||||
@ -204,7 +302,8 @@ void volPointInterpolation::interpolateBoundaryField
|
||||
}
|
||||
|
||||
// Sum collocated contributions
|
||||
mesh().globalData().syncPointData(pfi, plusEqOp<Type>());
|
||||
//mesh().globalData().syncPointData(pfi, plusEqOp<Type>());
|
||||
syncUntransformedData(pfi, plusEqOp<Type>());
|
||||
|
||||
// And add separated contributions
|
||||
addSeparated(pf);
|
||||
@ -213,7 +312,8 @@ void volPointInterpolation::interpolateBoundaryField
|
||||
// a coupled point to have its master on a different patch so
|
||||
// to make sure just push master data to slaves. Reuse the syncPointData
|
||||
// structure.
|
||||
mesh().globalData().syncPointData(pfi, nopEqOp<Type>());
|
||||
//mesh().globalData().syncPointData(pfi, nopEqOp<Type>());
|
||||
pushUntransformedData(pfi);
|
||||
|
||||
|
||||
|
||||
@ -238,7 +338,8 @@ void volPointInterpolation::interpolateBoundaryField
|
||||
pf.correctBoundaryConditions();
|
||||
|
||||
// Sync any dangling points
|
||||
mesh().globalData().syncPointData(pfi, nopEqOp<Type>());
|
||||
//mesh().globalData().syncPointData(pfi, nopEqOp<Type>());
|
||||
pushUntransformedData(pfi);
|
||||
|
||||
// Apply multiple constraints on edge/corner points
|
||||
applyCornerConstraints(pf);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,10 +101,11 @@ void volPointInterpolation::calcBoundaryAddressing()
|
||||
// no face of a certain patch still can have boundary points marked.
|
||||
if (debug)
|
||||
{
|
||||
|
||||
boolList oldData(isPatchPoint_);
|
||||
|
||||
mesh().globalData().syncPointData(isPatchPoint_, orEqOp<bool>());
|
||||
//mesh().globalData().syncPointData(isPatchPoint_, orEqOp<bool>());
|
||||
syncUntransformedData(isPatchPoint_, orEqOp<bool>());
|
||||
|
||||
|
||||
forAll(isPatchPoint_, pointI)
|
||||
{
|
||||
@ -281,7 +282,8 @@ void volPointInterpolation::makeWeights()
|
||||
|
||||
|
||||
// Sum collocated contributions
|
||||
mesh().globalData().syncPointData(sumWeights, plusEqOp<scalar>());
|
||||
//mesh().globalData().syncPointData(sumWeights, plusEqOp<scalar>());
|
||||
syncUntransformedData(sumWeights, plusEqOp<scalar>());
|
||||
|
||||
// And add separated contributions
|
||||
addSeparated(sumWeights);
|
||||
@ -290,7 +292,8 @@ void volPointInterpolation::makeWeights()
|
||||
// a coupled point to have its master on a different patch so
|
||||
// to make sure just push master data to slaves. Reuse the syncPointData
|
||||
// structure.
|
||||
mesh().globalData().syncPointData(sumWeights, nopEqOp<scalar>());
|
||||
//mesh().globalData().syncPointData(sumWeights, nopEqOp<scalar>());
|
||||
pushUntransformedData(sumWeights);
|
||||
|
||||
|
||||
// Normalise internal weights
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -105,6 +105,18 @@ class volPointInterpolation
|
||||
//- Make patch-patch constraints
|
||||
void makePatchPatchAddressing();
|
||||
|
||||
//- Helper: sync data on collocated points only
|
||||
template<class Type, class CombineOp>
|
||||
void syncUntransformedData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const CombineOp& cop
|
||||
) const;
|
||||
|
||||
//- Helper: push master point data to collocated points
|
||||
template<class Type>
|
||||
void pushUntransformedData(List<Type>&) const;
|
||||
|
||||
//- Get boundary field in same order as boundary faces. Field is
|
||||
// zero on all coupled and empty patches
|
||||
template<class Type>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,6 +24,11 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "InteractionLists.H"
|
||||
#include "globalIndexAndTransform.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataFace.H"
|
||||
#include "treeDataCell.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -61,7 +66,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
||||
(
|
||||
procBb,
|
||||
allExtendedProcBbs,
|
||||
globalTransforms_,
|
||||
mesh_.globalData().globalTransforms(),
|
||||
extendedProcBbsInRange,
|
||||
extendedProcBbsTransformIndex,
|
||||
extendedProcBbsOrigProc
|
||||
@ -81,6 +86,9 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
||||
);
|
||||
}
|
||||
|
||||
const globalIndexAndTransform& globalTransforms =
|
||||
mesh_.globalData().globalTransforms();
|
||||
|
||||
// Recording which cells are in range of an extended boundBox, as
|
||||
// only these cells will need to be tested to determine which
|
||||
// referred cells that they interact with.
|
||||
@ -116,7 +124,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
||||
|
||||
cellIAndTToExchange.append
|
||||
(
|
||||
globalTransforms_.encode(cellI, transformIndex)
|
||||
globalTransforms.encode(cellI, transformIndex)
|
||||
);
|
||||
|
||||
cellBbsToExchange.append(cellBb);
|
||||
@ -173,14 +181,14 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
||||
{
|
||||
const labelPair& ciat = cellIAndTToExchange[bbI];
|
||||
|
||||
const vectorTensorTransform& transform = globalTransforms_.transform
|
||||
const vectorTensorTransform& transform = globalTransforms.transform
|
||||
(
|
||||
globalTransforms_.transformIndex(ciat)
|
||||
globalTransforms.transformIndex(ciat)
|
||||
);
|
||||
|
||||
treeBoundBox tempTransformedBb
|
||||
(
|
||||
transform.invTransform(cellBbsToExchange[bbI].points())
|
||||
transform.invTransformPosition(cellBbsToExchange[bbI].points())
|
||||
);
|
||||
|
||||
treeBoundBox extendedBb
|
||||
@ -352,7 +360,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
||||
|
||||
wallFaceIAndTToExchange.append
|
||||
(
|
||||
globalTransforms_.encode(wallFaceI, transformIndex)
|
||||
globalTransforms.encode(wallFaceI, transformIndex)
|
||||
);
|
||||
|
||||
wallFaceBbsToExchange.append(wallFaceBb);
|
||||
@ -390,14 +398,14 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
||||
{
|
||||
const labelPair& wfiat = wallFaceIAndTToExchange[bbI];
|
||||
|
||||
const vectorTensorTransform& transform = globalTransforms_.transform
|
||||
const vectorTensorTransform& transform = globalTransforms.transform
|
||||
(
|
||||
globalTransforms_.transformIndex(wfiat)
|
||||
globalTransforms.transformIndex(wfiat)
|
||||
);
|
||||
|
||||
treeBoundBox tempTransformedBb
|
||||
(
|
||||
transform.invTransform(wallFaceBbsToExchange[bbI].points())
|
||||
transform.invTransformPosition(wallFaceBbsToExchange[bbI].points())
|
||||
);
|
||||
|
||||
treeBoundBox extendedBb
|
||||
@ -518,11 +526,11 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
||||
{
|
||||
const labelPair& wfiat = wallFaceIndexAndTransformToDistribute_[rWFI];
|
||||
|
||||
label wallFaceIndex = globalTransforms_.index(wfiat);
|
||||
label wallFaceIndex = globalTransforms.index(wfiat);
|
||||
|
||||
const vectorTensorTransform& transform = globalTransforms_.transform
|
||||
const vectorTensorTransform& transform = globalTransforms.transform
|
||||
(
|
||||
globalTransforms_.transformIndex(wfiat)
|
||||
globalTransforms.transformIndex(wfiat)
|
||||
);
|
||||
|
||||
const face& f = mesh_.faces()[wallFaceIndex];
|
||||
@ -535,7 +543,7 @@ void Foam::InteractionLists<ParticleType>::buildInteractionLists()
|
||||
referredWallFaces_[rWFI] = referredWallFace
|
||||
(
|
||||
face(identity(f.size())),
|
||||
transform.invTransform(f.points(mesh_.points())),
|
||||
transform.invTransformPosition(f.points(mesh_.points())),
|
||||
patchI
|
||||
);
|
||||
}
|
||||
@ -700,7 +708,7 @@ void Foam::InteractionLists<ParticleType>::findExtendedProcBbsInRange
|
||||
|
||||
treeBoundBox extendedReferredProcBb
|
||||
(
|
||||
transform.transform
|
||||
transform.transformPosition
|
||||
(
|
||||
allExtendedProcBbs[procI].points()
|
||||
)
|
||||
@ -747,7 +755,7 @@ void Foam::InteractionLists<ParticleType>::findExtendedProcBbsInRange
|
||||
|
||||
treeBoundBox extendedReferredProcBb
|
||||
(
|
||||
transform.transform
|
||||
transform.transformPosition
|
||||
(
|
||||
allExtendedProcBbs[procI].points()
|
||||
)
|
||||
@ -790,7 +798,7 @@ void Foam::InteractionLists<ParticleType>::findExtendedProcBbsInRange
|
||||
|
||||
treeBoundBox extendedReferredProcBb
|
||||
(
|
||||
transform.transform
|
||||
transform.transformPosition
|
||||
(
|
||||
allExtendedProcBbs[procI].points()
|
||||
)
|
||||
@ -911,6 +919,10 @@ void Foam::InteractionLists<ParticleType>::prepareParticlesToRefer
|
||||
const List<DynamicList<ParticleType*> >& cellOccupancy
|
||||
)
|
||||
{
|
||||
const globalIndexAndTransform& globalTransforms =
|
||||
mesh_.globalData().globalTransforms();
|
||||
|
||||
|
||||
referredParticles_.setSize(cellIndexAndTransformToDistribute_.size());
|
||||
|
||||
// Clear all existing referred particles
|
||||
@ -927,7 +939,7 @@ void Foam::InteractionLists<ParticleType>::prepareParticlesToRefer
|
||||
{
|
||||
const labelPair ciat = cellIndexAndTransformToDistribute_[i];
|
||||
|
||||
label cellIndex = globalTransforms_.index(ciat);
|
||||
label cellIndex = globalTransforms.index(ciat);
|
||||
|
||||
List<ParticleType*> realParticles = cellOccupancy[cellIndex];
|
||||
|
||||
@ -952,12 +964,15 @@ void Foam::InteractionLists<ParticleType>::prepareParticleToBeReferred
|
||||
labelPair ciat
|
||||
)
|
||||
{
|
||||
const vectorTensorTransform& transform = globalTransforms_.transform
|
||||
const globalIndexAndTransform& globalTransforms =
|
||||
mesh_.globalData().globalTransforms();
|
||||
|
||||
const vectorTensorTransform& transform = globalTransforms.transform
|
||||
(
|
||||
globalTransforms_.transformIndex(ciat)
|
||||
globalTransforms.transformIndex(ciat)
|
||||
);
|
||||
|
||||
particle->position() = transform.invTransform(particle->position());
|
||||
particle->position() = transform.invTransformPosition(particle->position());
|
||||
|
||||
particle->transformProperties(-transform.t());
|
||||
|
||||
@ -993,6 +1008,9 @@ void Foam::InteractionLists<ParticleType>::fillReferredParticleCloud()
|
||||
template<class ParticleType>
|
||||
void Foam::InteractionLists<ParticleType>::prepareWallDataToRefer()
|
||||
{
|
||||
const globalIndexAndTransform& globalTransforms =
|
||||
mesh_.globalData().globalTransforms();
|
||||
|
||||
referredWallData_.setSize
|
||||
(
|
||||
wallFaceIndexAndTransformToDistribute_.size()
|
||||
@ -1004,11 +1022,11 @@ void Foam::InteractionLists<ParticleType>::prepareWallDataToRefer()
|
||||
{
|
||||
const labelPair& wfiat = wallFaceIndexAndTransformToDistribute_[rWVI];
|
||||
|
||||
label wallFaceIndex = globalTransforms_.index(wfiat);
|
||||
label wallFaceIndex = globalTransforms.index(wfiat);
|
||||
|
||||
const vectorTensorTransform& transform = globalTransforms_.transform
|
||||
const vectorTensorTransform& transform = globalTransforms.transform
|
||||
(
|
||||
globalTransforms_.transformIndex(wfiat)
|
||||
globalTransforms.transformIndex(wfiat)
|
||||
);
|
||||
|
||||
label patchI = mesh_.boundaryMesh().patchID()
|
||||
@ -1088,7 +1106,6 @@ Foam::InteractionLists<ParticleType>::InteractionLists(const polyMesh& mesh)
|
||||
writeCloud_(false),
|
||||
cellMapPtr_(),
|
||||
wallFaceMapPtr_(),
|
||||
globalTransforms_(mesh_),
|
||||
maxDistance_(0.0),
|
||||
dil_(),
|
||||
dwfil_(),
|
||||
@ -1117,7 +1134,6 @@ Foam::InteractionLists<ParticleType>::InteractionLists
|
||||
writeCloud_(writeCloud),
|
||||
cellMapPtr_(),
|
||||
wallFaceMapPtr_(),
|
||||
globalTransforms_(mesh_),
|
||||
maxDistance_(maxDistance),
|
||||
dil_(),
|
||||
dwfil_(),
|
||||
|
||||
@ -60,21 +60,17 @@ SourceFiles
|
||||
#define InteractionLists_H
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "globalIndexAndTransform.H"
|
||||
#include "referredWallFace.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "Tuple2.H"
|
||||
#include "treeDataCell.H"
|
||||
#include "treeDataFace.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "volFields.H"
|
||||
#include "Random.H"
|
||||
//#include "mapDistribute.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class globalIndexAndTransform;
|
||||
class mapDistribute;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class InteractionLists Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -100,10 +96,6 @@ class InteractionLists
|
||||
//- mapDistribute to exchange wall face data
|
||||
autoPtr<mapDistribute> wallFaceMapPtr_;
|
||||
|
||||
//- Storage and encoding/decoding for all possible transforms
|
||||
// of the geometry
|
||||
globalIndexAndTransform globalTransforms_;
|
||||
|
||||
//- Maximum distance over which interactions will be detected
|
||||
scalar maxDistance_;
|
||||
|
||||
@ -259,9 +251,6 @@ public:
|
||||
//- Return access to the wallFaceMap
|
||||
inline const mapDistribute& wallFaceMap() const;
|
||||
|
||||
//- Return access to the globalTransforms
|
||||
inline const globalIndexAndTransform& globalTransforms() const;
|
||||
|
||||
//- Return access to the direct interaction list
|
||||
inline const labelListList& dil() const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,14 +50,6 @@ Foam::InteractionLists<ParticleType>::wallFaceMap() const
|
||||
}
|
||||
|
||||
|
||||
template<class ParticleType>
|
||||
const Foam::globalIndexAndTransform&
|
||||
Foam::InteractionLists<ParticleType>::globalTransforms() const
|
||||
{
|
||||
return globalTransforms_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParticleType>
|
||||
const Foam::labelListList& Foam::InteractionLists<ParticleType>::dil() const
|
||||
{
|
||||
|
||||
@ -4,8 +4,6 @@ indexedParticle = indexedParticle
|
||||
$(passiveParticle)/passiveParticleCloud.C
|
||||
$(indexedParticle)/indexedParticleCloud.C
|
||||
|
||||
InteractionLists/globalIndexAndTransform/globalIndexAndTransform.C
|
||||
InteractionLists/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C
|
||||
InteractionLists/referredWallFace/referredWallFace.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/liblagrangian
|
||||
|
||||
@ -74,7 +74,7 @@ Foam::KinematicCloud<ParcelType>::cloudSolution::cloudSolution
|
||||
coupled_(false),
|
||||
cellValueSourceCorrection_(false),
|
||||
maxTrackTime_(0.0),
|
||||
resetSourcesOnStartup_(false)
|
||||
resetSourcesOnStartup_(true)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
@ -188,6 +188,84 @@ bool Foam::KinematicCloud<ParcelType>::cloudSolution::output() const
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
void Foam::KinematicCloud<ParcelType>::setModels()
|
||||
{
|
||||
collisionModel_.reset
|
||||
(
|
||||
CollisionModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
dispersionModel_.reset
|
||||
(
|
||||
DispersionModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
dragModel_.reset
|
||||
(
|
||||
DragModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
injectionModel_.reset
|
||||
(
|
||||
InjectionModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
patchInteractionModel_.reset
|
||||
(
|
||||
PatchInteractionModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
postProcessingModel_.reset
|
||||
(
|
||||
PostProcessingModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
surfaceFilmModel_.reset
|
||||
(
|
||||
SurfaceFilmModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this,
|
||||
g_
|
||||
).ptr()
|
||||
);
|
||||
|
||||
UIntegrator_.reset
|
||||
(
|
||||
vectorIntegrationScheme::New
|
||||
(
|
||||
"U",
|
||||
solution_.integrationSchemes()
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
void Foam::KinematicCloud<ParcelType>::solve
|
||||
(
|
||||
@ -450,8 +528,8 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
|
||||
)
|
||||
),
|
||||
solution_(mesh_, particleProperties_.subDict("solution")),
|
||||
constProps_(particleProperties_),
|
||||
subModelProperties_(particleProperties_.subDict("subModels")),
|
||||
constProps_(particleProperties_, solution_.active()),
|
||||
subModelProperties_(particleProperties_.subOrEmptyDict("subModels")),
|
||||
rndGen_
|
||||
(
|
||||
label(0),
|
||||
@ -462,72 +540,15 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
|
||||
U_(U),
|
||||
mu_(mu),
|
||||
g_(g),
|
||||
forces_(mesh_, particleProperties_, g_.value()),
|
||||
collisionModel_
|
||||
(
|
||||
CollisionModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
)
|
||||
),
|
||||
dispersionModel_
|
||||
(
|
||||
DispersionModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
)
|
||||
),
|
||||
dragModel_
|
||||
(
|
||||
DragModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
)
|
||||
),
|
||||
injectionModel_
|
||||
(
|
||||
InjectionModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
)
|
||||
),
|
||||
patchInteractionModel_
|
||||
(
|
||||
PatchInteractionModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
)
|
||||
),
|
||||
postProcessingModel_
|
||||
(
|
||||
PostProcessingModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this
|
||||
)
|
||||
),
|
||||
surfaceFilmModel_
|
||||
(
|
||||
SurfaceFilmModel<KinematicCloud<ParcelType> >::New
|
||||
(
|
||||
subModelProperties_,
|
||||
*this,
|
||||
g
|
||||
)
|
||||
),
|
||||
UIntegrator_
|
||||
(
|
||||
vectorIntegrationScheme::New
|
||||
(
|
||||
"U",
|
||||
solution_.integrationSchemes()
|
||||
)
|
||||
),
|
||||
forces_(mesh_, particleProperties_, g_.value(), solution_.active()),
|
||||
collisionModel_(NULL),
|
||||
dispersionModel_(NULL),
|
||||
dragModel_(NULL),
|
||||
injectionModel_(NULL),
|
||||
patchInteractionModel_(NULL),
|
||||
postProcessingModel_(NULL),
|
||||
surfaceFilmModel_(NULL),
|
||||
UIntegrator_(NULL),
|
||||
UTrans_
|
||||
(
|
||||
new DimensionedField<vector, volMesh>
|
||||
@ -561,6 +582,11 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
|
||||
)
|
||||
)
|
||||
{
|
||||
if (solution_.active())
|
||||
{
|
||||
setModels();
|
||||
}
|
||||
|
||||
if (readFields)
|
||||
{
|
||||
ParcelType::readFields(*this);
|
||||
|
||||
@ -364,6 +364,12 @@ protected:
|
||||
autoPtr<DimensionedField<scalar, volMesh> > UCoeff_;
|
||||
|
||||
|
||||
// Initialisation
|
||||
|
||||
//- Set cloud sub-models
|
||||
void setModels();
|
||||
|
||||
|
||||
// Cloud evolution functions
|
||||
|
||||
//- Solve the cloud - calls all evolution functions
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,6 +30,29 @@ License
|
||||
|
||||
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
void Foam::ReactingCloud<ParcelType>::setModels()
|
||||
{
|
||||
compositionModel_.reset
|
||||
(
|
||||
CompositionModel<ReactingCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
phaseChangeModel_.reset
|
||||
(
|
||||
PhaseChangeModel<ReactingCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
|
||||
(
|
||||
@ -85,26 +108,17 @@ Foam::ReactingCloud<ParcelType>::ReactingCloud
|
||||
ThermoCloud<ParcelType>(cloudName, rho, U, g, thermo, false),
|
||||
reactingCloud(),
|
||||
cloudCopyPtr_(NULL),
|
||||
constProps_(this->particleProperties()),
|
||||
compositionModel_
|
||||
(
|
||||
CompositionModel<ReactingCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
)
|
||||
),
|
||||
phaseChangeModel_
|
||||
(
|
||||
PhaseChangeModel<ReactingCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
)
|
||||
),
|
||||
constProps_(this->particleProperties(), this->solution().active()),
|
||||
compositionModel_(NULL),
|
||||
phaseChangeModel_(NULL),
|
||||
rhoTrans_(thermo.carrier().species().size()),
|
||||
dMassPhaseChange_(0.0)
|
||||
{
|
||||
if (this->solution().active())
|
||||
{
|
||||
setModels();
|
||||
}
|
||||
|
||||
// Set storage for mass source fields and initialise to zero
|
||||
forAll(rhoTrans_, i)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -128,6 +128,12 @@ protected:
|
||||
);
|
||||
|
||||
|
||||
// Initialisation
|
||||
|
||||
//- Set cloud sub-models
|
||||
void setModels();
|
||||
|
||||
|
||||
// Cloud evolution functions
|
||||
|
||||
//- Reset state of cloud
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,6 +30,29 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
void Foam::ReactingMultiphaseCloud<ParcelType>::setModels()
|
||||
{
|
||||
devolatilisationModel_.reset
|
||||
(
|
||||
DevolatilisationModel<ReactingMultiphaseCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
surfaceReactionModel_.reset
|
||||
(
|
||||
SurfaceReactionModel<ReactingMultiphaseCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
void Foam::ReactingMultiphaseCloud<ParcelType>::cloudReset
|
||||
(
|
||||
@ -62,26 +85,17 @@ Foam::ReactingMultiphaseCloud<ParcelType>::ReactingMultiphaseCloud
|
||||
ReactingCloud<ParcelType>(cloudName, rho, U, g, thermo, false),
|
||||
reactingMultiphaseCloud(),
|
||||
cloudCopyPtr_(NULL),
|
||||
constProps_(this->particleProperties()),
|
||||
devolatilisationModel_
|
||||
(
|
||||
DevolatilisationModel<ReactingMultiphaseCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
)
|
||||
),
|
||||
surfaceReactionModel_
|
||||
(
|
||||
SurfaceReactionModel<ReactingMultiphaseCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
)
|
||||
),
|
||||
constProps_(this->particleProperties(), this->solution().active()),
|
||||
devolatilisationModel_(NULL),
|
||||
surfaceReactionModel_(NULL),
|
||||
dMassDevolatilisation_(0.0),
|
||||
dMassSurfaceReaction_(0.0)
|
||||
{
|
||||
if (this->solution().active())
|
||||
{
|
||||
setModels();
|
||||
}
|
||||
|
||||
if (readFields)
|
||||
{
|
||||
ParcelType::readFields(*this);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -119,6 +119,12 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
// Initialisation
|
||||
|
||||
//- Set cloud sub-models
|
||||
void setModels();
|
||||
|
||||
|
||||
// Cloud evolution functions
|
||||
|
||||
//- Reset state of cloud
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,6 +30,31 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
void Foam::ThermoCloud<ParcelType>::setModels()
|
||||
{
|
||||
heatTransferModel_.reset
|
||||
(
|
||||
HeatTransferModel<ThermoCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
).ptr()
|
||||
);
|
||||
|
||||
TIntegrator_.reset
|
||||
(
|
||||
scalarIntegrationScheme::New
|
||||
(
|
||||
"T",
|
||||
this->solution().integrationSchemes()
|
||||
).ptr()
|
||||
);
|
||||
|
||||
this->subModelProperties().lookup("radiation") >> radiation_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
void Foam::ThermoCloud<ParcelType>::cloudReset(ThermoCloud<ParcelType>& c)
|
||||
{
|
||||
@ -66,27 +91,13 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
|
||||
),
|
||||
thermoCloud(),
|
||||
cloudCopyPtr_(NULL),
|
||||
constProps_(this->particleProperties()),
|
||||
constProps_(this->particleProperties(), this->solution().active()),
|
||||
thermo_(thermo),
|
||||
T_(thermo.thermo().T()),
|
||||
p_(thermo.thermo().p()),
|
||||
heatTransferModel_
|
||||
(
|
||||
HeatTransferModel<ThermoCloud<ParcelType> >::New
|
||||
(
|
||||
this->subModelProperties(),
|
||||
*this
|
||||
)
|
||||
),
|
||||
TIntegrator_
|
||||
(
|
||||
scalarIntegrationScheme::New
|
||||
(
|
||||
"T",
|
||||
this->solution().integrationSchemes()
|
||||
)
|
||||
),
|
||||
radiation_(this->subModelProperties().lookup("radiation")),
|
||||
heatTransferModel_(NULL),
|
||||
TIntegrator_(NULL),
|
||||
radiation_(false),
|
||||
hsTrans_
|
||||
(
|
||||
new DimensionedField<scalar, volMesh>
|
||||
@ -121,6 +132,11 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
|
||||
)
|
||||
|
||||
{
|
||||
if (this->solution().active())
|
||||
{
|
||||
setModels();
|
||||
}
|
||||
|
||||
if (readFields)
|
||||
{
|
||||
ParcelType::readFields(*this);
|
||||
@ -143,7 +159,7 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
|
||||
KinematicCloud<ParcelType>(c, name),
|
||||
thermoCloud(),
|
||||
cloudCopyPtr_(NULL),
|
||||
constProps_(c.particleProperties_),
|
||||
constProps_(c.constProps_),
|
||||
thermo_(c.thermo_),
|
||||
T_(c.T()),
|
||||
p_(c.p()),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -128,6 +128,12 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
// Initialisation
|
||||
|
||||
//- Set cloud sub-models
|
||||
void setModels();
|
||||
|
||||
|
||||
// Cloud evolution functions
|
||||
|
||||
//- Reset state of cloud
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -98,22 +98,22 @@ public:
|
||||
|
||||
//- Parcel type id - used for post-processing to flag the type
|
||||
// of parcels issued by this cloud
|
||||
const label parcelTypeId_;
|
||||
label parcelTypeId_;
|
||||
|
||||
//- Minimum density [kg/m3]
|
||||
const scalar rhoMin_;
|
||||
scalar rhoMin_;
|
||||
|
||||
//- Particle density [kg/m3] (constant)
|
||||
const scalar rho0_;
|
||||
scalar rho0_;
|
||||
|
||||
//- Minimum particle mass [kg]
|
||||
const scalar minParticleMass_;
|
||||
scalar minParticleMass_;
|
||||
|
||||
//- Young's modulus [N/m2]
|
||||
const scalar youngsModulus_;
|
||||
scalar youngsModulus_;
|
||||
|
||||
//- Poisson's ratio
|
||||
const scalar poissonsRatio_;
|
||||
scalar poissonsRatio_;
|
||||
|
||||
|
||||
public:
|
||||
@ -127,7 +127,11 @@ public:
|
||||
constantProperties(const constantProperties& cp);
|
||||
|
||||
//- Constructor from dictionary
|
||||
constantProperties(const dictionary& parentDict);
|
||||
constantProperties
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
const bool readFields = true
|
||||
);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -62,17 +62,28 @@ inline Foam::KinematicParcel<ParcelType>::constantProperties::constantProperties
|
||||
template<class ParcelType>
|
||||
inline Foam::KinematicParcel<ParcelType>::constantProperties::constantProperties
|
||||
(
|
||||
const dictionary& parentDict
|
||||
const dictionary& parentDict,
|
||||
const bool readFields
|
||||
)
|
||||
:
|
||||
dict_(parentDict.subDict("constantProperties")),
|
||||
parcelTypeId_(readLabel(dict_.lookup("parcelTypeId"))),
|
||||
rhoMin_(readScalar(dict_.lookup("rhoMin"))),
|
||||
rho0_(readScalar(dict_.lookup("rho0"))),
|
||||
minParticleMass_(readScalar(dict_.lookup("minParticleMass"))),
|
||||
youngsModulus_(readScalar(dict_.lookup("youngsModulus"))),
|
||||
poissonsRatio_(readScalar(dict_.lookup("poissonsRatio")))
|
||||
{}
|
||||
dict_(parentDict.subOrEmptyDict("constantProperties")),
|
||||
parcelTypeId_(-1),
|
||||
rhoMin_(0.0),
|
||||
rho0_(0.0),
|
||||
minParticleMass_(0.0),
|
||||
youngsModulus_(0.0),
|
||||
poissonsRatio_(0.0)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
dict_.lookup("parcelTypeId") >> parcelTypeId_;
|
||||
dict_.lookup("rhoMin") >> rhoMin_;
|
||||
dict_.lookup("rho0") >> rho0_;
|
||||
dict_.lookup("minParticleMass") >> minParticleMass_;
|
||||
dict_.lookup("youngsModulus") >> youngsModulus_;
|
||||
dict_.lookup("poissonsRatio") >> poissonsRatio_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -82,7 +82,7 @@ public:
|
||||
// Private data
|
||||
|
||||
//- Latent heat of devolatilisation [J/kg]
|
||||
const scalar LDevol_;
|
||||
scalar LDevol_;
|
||||
|
||||
//- Fraction of enthalpy retained by parcel due to surface
|
||||
// reactions
|
||||
@ -100,7 +100,11 @@ public:
|
||||
constantProperties(const constantProperties& cp);
|
||||
|
||||
//- Constructor from dictionary
|
||||
constantProperties(const dictionary& parentDict);
|
||||
constantProperties
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
const bool readFields = true
|
||||
);
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,24 +54,31 @@ template<class ParcelType>
|
||||
inline Foam::ReactingMultiphaseParcel<ParcelType>::constantProperties::
|
||||
constantProperties
|
||||
(
|
||||
const dictionary& parentDict
|
||||
const dictionary& parentDict,
|
||||
const bool readFields
|
||||
)
|
||||
:
|
||||
ReactingParcel<ParcelType>::constantProperties(parentDict),
|
||||
LDevol_(readScalar(this->dict().lookup("LDevol"))),
|
||||
hRetentionCoeff_(readScalar(this->dict().lookup("hRetentionCoeff")))
|
||||
ReactingParcel<ParcelType>::constantProperties(parentDict, readFields),
|
||||
LDevol_(0.0),
|
||||
hRetentionCoeff_(0.0)
|
||||
{
|
||||
if ((hRetentionCoeff_ < 0) || (hRetentionCoeff_ > 1))
|
||||
if (readFields)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"ReactingMultiphaseParcel<ParcelType>::constantProperties::"
|
||||
"constantProperties"
|
||||
) << "hRetentionCoeff must be in the range 0 to 1" << nl
|
||||
<< exit(FatalError) << endl;
|
||||
}
|
||||
this->dict().lookup("LDevol") >> LDevol_;
|
||||
this->dict().lookup("hRetentionCoeff") >> hRetentionCoeff_;
|
||||
|
||||
hRetentionCoeff_ = max(1e-06, hRetentionCoeff_);
|
||||
if ((hRetentionCoeff_ < 0) || (hRetentionCoeff_ > 1))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"ReactingMultiphaseParcel<ParcelType>::constantProperties::"
|
||||
"constantProperties"
|
||||
) << "hRetentionCoeff must be in the range 0 to 1" << nl
|
||||
<< exit(FatalError) << endl;
|
||||
}
|
||||
|
||||
hRetentionCoeff_ = max(1e-06, hRetentionCoeff_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -77,16 +77,16 @@ public:
|
||||
// Private data
|
||||
|
||||
//- Minimum pressure [Pa]
|
||||
const scalar pMin_;
|
||||
scalar pMin_;
|
||||
|
||||
//- Constant volume flag - e.g. during mass transfer
|
||||
Switch constantVolume_;
|
||||
|
||||
//- Vaporisation temperature [K]
|
||||
const scalar Tvap_;
|
||||
scalar Tvap_;
|
||||
|
||||
//- Boiling point [K]
|
||||
const scalar Tbp_;
|
||||
scalar Tbp_;
|
||||
|
||||
|
||||
public:
|
||||
@ -100,7 +100,11 @@ public:
|
||||
constantProperties(const constantProperties& cp);
|
||||
|
||||
//- Constructor from dictionary
|
||||
constantProperties(const dictionary& parentDict);
|
||||
constantProperties
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
const bool readFields = true
|
||||
);
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -54,15 +54,24 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
|
||||
template<class ParcelType>
|
||||
inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
|
||||
(
|
||||
const dictionary& parentDict
|
||||
const dictionary& parentDict,
|
||||
const bool readFields
|
||||
)
|
||||
:
|
||||
ThermoParcel<ParcelType>::constantProperties(parentDict),
|
||||
pMin_(readScalar(this->dict().lookup("pMin"))),
|
||||
constantVolume_(this->dict().lookup("constantVolume")),
|
||||
Tvap_(readScalar(this->dict().lookup("Tvap"))),
|
||||
Tbp_(readScalar(this->dict().lookup("Tbp")))
|
||||
{}
|
||||
ThermoParcel<ParcelType>::constantProperties(parentDict, readFields),
|
||||
pMin_(0.0),
|
||||
constantVolume_(false),
|
||||
Tvap_(0.0),
|
||||
Tbp_(0.0)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
this->dict().lookup("pMin") >> pMin_;
|
||||
this->dict().lookup("constantVolume") >> constantVolume_;
|
||||
this->dict().lookup("Tvap") >> Tvap_;
|
||||
this->dict().lookup("Tbp") >> Tbp_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
|
||||
@ -77,22 +77,22 @@ public:
|
||||
// Private data
|
||||
|
||||
//- Particle initial temperature [K]
|
||||
const scalar T0_;
|
||||
scalar T0_;
|
||||
|
||||
//- Minimum temperature [K]
|
||||
const scalar TMin_;
|
||||
scalar TMin_;
|
||||
|
||||
//- Particle specific heat capacity [J/(kg.K)]
|
||||
const scalar Cp0_;
|
||||
scalar Cp0_;
|
||||
|
||||
//- Particle emissivity [] (radiation)
|
||||
const scalar epsilon0_;
|
||||
scalar epsilon0_;
|
||||
|
||||
//- Particle scattering factor [] (radiation)
|
||||
const scalar f0_;
|
||||
scalar f0_;
|
||||
|
||||
//- Default carrier Prandtl number []
|
||||
const scalar Pr_;
|
||||
scalar Pr_;
|
||||
|
||||
|
||||
public:
|
||||
@ -106,7 +106,11 @@ public:
|
||||
constantProperties(const constantProperties& cp);
|
||||
|
||||
//- Constructor from dictionary
|
||||
constantProperties(const dictionary& parentDict);
|
||||
constantProperties
|
||||
(
|
||||
const dictionary& parentDict,
|
||||
const bool readFields = true
|
||||
);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,17 +57,28 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
|
||||
template<class ParcelType>
|
||||
inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
|
||||
(
|
||||
const dictionary& parentDict
|
||||
const dictionary& parentDict,
|
||||
const bool readFields
|
||||
)
|
||||
:
|
||||
KinematicParcel<ParcelType>::constantProperties(parentDict),
|
||||
T0_(readScalar(this->dict().lookup("T0"))),
|
||||
TMin_(readScalar(this->dict().lookup("TMin"))),
|
||||
Cp0_(readScalar(this->dict().lookup("Cp0"))),
|
||||
epsilon0_(readScalar(this->dict().lookup("epsilon0"))),
|
||||
f0_(readScalar(this->dict().lookup("f0"))),
|
||||
Pr_(readScalar(this->dict().lookup("Pr")))
|
||||
{}
|
||||
KinematicParcel<ParcelType>::constantProperties(parentDict, readFields),
|
||||
T0_(0.0),
|
||||
TMin_(0.0),
|
||||
Cp0_(0.0),
|
||||
epsilon0_(0.0),
|
||||
f0_(0.0),
|
||||
Pr_(0.0)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
this->dict().lookup("T0") >> T0_;
|
||||
this->dict().lookup("TMin") >> TMin_;
|
||||
this->dict().lookup("Cp0") >> Cp0_;
|
||||
this->dict().lookup("epsilon0") >> epsilon0_;
|
||||
this->dict().lookup("f0") >> f0_;
|
||||
this->dict().lookup("Pr") >> Pr_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -74,32 +74,41 @@ Foam::particleForces::particleForces
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const vector& g
|
||||
const vector& g,
|
||||
const bool readFields
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
dict_(dict.subDict("particleForces")),
|
||||
dict_(dict.subOrEmptyDict("particleForces")),
|
||||
g_(g),
|
||||
gradUPtr_(NULL),
|
||||
HdotGradHInterPtr_(NULL),
|
||||
gravity_(dict_.lookup("gravity")),
|
||||
virtualMass_(dict_.lookup("virtualMass")),
|
||||
gravity_(false),
|
||||
virtualMass_(false),
|
||||
Cvm_(0.0),
|
||||
pressureGradient_(dict_.lookup("pressureGradient")),
|
||||
paramagnetic_(dict_.lookup("paramagnetic")),
|
||||
pressureGradient_(false),
|
||||
paramagnetic_(false),
|
||||
magneticSusceptibility_(0.0),
|
||||
refFrame_(rfInertial),
|
||||
UName_(dict_.lookupOrDefault<word>("UName", "U")),
|
||||
HdotGradHName_(dict_.lookupOrDefault<word>("HdotGradHName", "HdotGradH"))
|
||||
{
|
||||
if (virtualMass_)
|
||||
if (readFields)
|
||||
{
|
||||
dict_.lookup("Cvm") >> Cvm_;
|
||||
}
|
||||
dict_.lookup("gravity") >> gravity_;
|
||||
dict_.lookup("virtualMass") >> virtualMass_;
|
||||
dict_.lookup("pressureGradient") >> pressureGradient_;
|
||||
dict_.lookup("paramagnetic") >> paramagnetic_;
|
||||
|
||||
if (paramagnetic_)
|
||||
{
|
||||
dict_.lookup("magneticSusceptibility") >> magneticSusceptibility_;
|
||||
if (virtualMass_)
|
||||
{
|
||||
dict_.lookup("Cvm") >> Cvm_;
|
||||
}
|
||||
|
||||
if (paramagnetic_)
|
||||
{
|
||||
dict_.lookup("magneticSusceptibility") >> magneticSusceptibility_;
|
||||
}
|
||||
}
|
||||
|
||||
if (dict_.found("referenceFrame"))
|
||||
@ -116,9 +125,10 @@ Foam::particleForces::particleForces
|
||||
(
|
||||
"Foam::particleForces::particleForces"
|
||||
"("
|
||||
"const fvMesh& mesh,"
|
||||
"const dictionary& dict,"
|
||||
"const vector& g"
|
||||
"const fvMesh&, "
|
||||
"const dictionary&, "
|
||||
"const vector&, "
|
||||
"const bool"
|
||||
")"
|
||||
)
|
||||
<< "Unknown referenceFrame, options are inertial and SRF."
|
||||
@ -235,10 +245,8 @@ void Foam::particleForces::cacheFields
|
||||
|
||||
if (paramagnetic_)
|
||||
{
|
||||
const volVectorField& HdotGradH = mesh_.lookupObject<volVectorField>
|
||||
(
|
||||
HdotGradHName_
|
||||
);
|
||||
const volVectorField& HdotGradH =
|
||||
mesh_.lookupObject<volVectorField>(HdotGradHName_);
|
||||
|
||||
HdotGradHInterPtr_ = interpolation<vector>::New
|
||||
(
|
||||
@ -329,7 +337,7 @@ Foam::vector Foam::particleForces::calcNonCoupled
|
||||
// *magneticSusceptibility_/(magneticSusceptibility_ + 3)
|
||||
// *HdotGradH[cellI];
|
||||
|
||||
// which is divided by mass ((4/3)*pi*r^3*rho) to produce
|
||||
// which is divided by mass (pi*d^3*rho/6) to produce
|
||||
// acceleration
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -134,7 +134,8 @@ public:
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const vector& g
|
||||
const vector& g,
|
||||
const bool readFields = true
|
||||
);
|
||||
|
||||
//- Construct copy
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1791,7 +1791,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMeshRegions
|
||||
"meshRefinement::splitMeshRegions(const point&)"
|
||||
) << "Point " << keepPoint
|
||||
<< " is not inside the mesh." << nl
|
||||
<< "Bounding box of the mesh:" << mesh_.globalData().bb()
|
||||
<< "Bounding box of the mesh:" << mesh_.bounds()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1263,7 +1263,7 @@ void Foam::meshRefinement::findCellZoneInsideWalk
|
||||
", const labelList&, const labelList&)"
|
||||
) << "Point " << insidePoint
|
||||
<< " is not inside the mesh." << nl
|
||||
<< "Bounding box of the mesh:" << mesh_.globalData().bb()
|
||||
<< "Bounding box of the mesh:" << mesh_.bounds()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -1431,7 +1431,7 @@ void Foam::meshRefinement::findCellZoneTopo
|
||||
"(const point&, const labelList&, const labelList&, labelList&)"
|
||||
) << "Point " << keepPoint
|
||||
<< " is not inside the mesh." << nl
|
||||
<< "Bounding box of the mesh:" << mesh_.globalData().bb()
|
||||
<< "Bounding box of the mesh:" << mesh_.bounds()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -1972,7 +1972,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
||||
"(const label, const labelList&, const point&)"
|
||||
) << "Point " << keepPoint
|
||||
<< " is not inside the mesh." << nl
|
||||
<< "Bounding box of the mesh:" << mesh_.globalData().bb()
|
||||
<< "Bounding box of the mesh:" << mesh_.bounds()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1623,58 +1623,76 @@ void Foam::indexedOctree<Type>::traverseNode
|
||||
{
|
||||
const labelList& indices = contents_[getContent(index)];
|
||||
|
||||
if (findAny)
|
||||
if (indices.size())
|
||||
{
|
||||
// Find any intersection
|
||||
|
||||
forAll(indices, elemI)
|
||||
if (findAny)
|
||||
{
|
||||
label shapeI = indices[elemI];
|
||||
// Find any intersection
|
||||
|
||||
point pt;
|
||||
bool hit = shapes_.intersects(shapeI, start, end, pt);
|
||||
|
||||
if (hit)
|
||||
forAll(indices, elemI)
|
||||
{
|
||||
// Hit so pt is nearer than nearestPoint.
|
||||
// Update hit info
|
||||
hitInfo.setHit();
|
||||
hitInfo.setIndex(shapeI);
|
||||
hitInfo.setPoint(pt);
|
||||
label shapeI = indices[elemI];
|
||||
|
||||
point pt;
|
||||
bool hit = shapes_.intersects(shapeI, start, end, pt);
|
||||
|
||||
// Note that intersection of shape might actually be
|
||||
// in a neighbouring box. For findAny this is not important.
|
||||
if (hit)
|
||||
{
|
||||
// Hit so pt is nearer than nearestPoint.
|
||||
// Update hit info
|
||||
hitInfo.setHit();
|
||||
hitInfo.setIndex(shapeI);
|
||||
hitInfo.setPoint(pt);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find nearest intersection
|
||||
|
||||
const treeBoundBox octantBb(subBbox(nodeI, octant));
|
||||
|
||||
point nearestPoint(end);
|
||||
|
||||
forAll(indices, elemI)
|
||||
{
|
||||
label shapeI = indices[elemI];
|
||||
|
||||
point pt;
|
||||
bool hit = shapes_.intersects
|
||||
(
|
||||
shapeI,
|
||||
start,
|
||||
nearestPoint,
|
||||
pt
|
||||
);
|
||||
|
||||
// Note that intersection of shape might actually be
|
||||
// in a neighbouring box. Since we need to maintain strict
|
||||
// (findAny=false) ordering skip such an intersection. It
|
||||
// will be found when we are doing the next box.
|
||||
|
||||
if (hit && octantBb.contains(pt))
|
||||
{
|
||||
// Hit so pt is nearer than nearestPoint.
|
||||
nearestPoint = pt;
|
||||
// Update hit info
|
||||
hitInfo.setHit();
|
||||
hitInfo.setIndex(shapeI);
|
||||
hitInfo.setPoint(pt);
|
||||
}
|
||||
}
|
||||
|
||||
if (hitInfo.hit())
|
||||
{
|
||||
// Found intersected shape.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find nearest intersection.
|
||||
|
||||
point nearestPoint(end);
|
||||
|
||||
forAll(indices, elemI)
|
||||
{
|
||||
label shapeI = indices[elemI];
|
||||
|
||||
point pt;
|
||||
bool hit = shapes_.intersects(shapeI, start, nearestPoint, pt);
|
||||
|
||||
if (hit)
|
||||
{
|
||||
// Hit so pt is nearer than nearestPoint.
|
||||
nearestPoint = pt;
|
||||
// Update hit info
|
||||
hitInfo.setHit();
|
||||
hitInfo.setIndex(shapeI);
|
||||
hitInfo.setPoint(pt);
|
||||
}
|
||||
}
|
||||
|
||||
if (hitInfo.hit())
|
||||
{
|
||||
// Found intersected shape.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing intersected in this node
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,9 +101,11 @@ Foam::label Foam::meshSearch::findNearestCellTree(const point& location) const
|
||||
{
|
||||
const indexedOctree<treeDataCell>& tree = cellTree();
|
||||
|
||||
scalar span = tree.bb().mag();
|
||||
|
||||
pointIndexHit info = tree.findNearest(location, Foam::sqr(span));
|
||||
pointIndexHit info = tree.findNearest
|
||||
(
|
||||
location,
|
||||
magSqr(tree.bb().max()-tree.bb().min())
|
||||
);
|
||||
|
||||
if (!info.hit())
|
||||
{
|
||||
@ -178,10 +180,12 @@ Foam::label Foam::meshSearch::findNearestFaceTree(const point& location) const
|
||||
// Search nearest cell centre.
|
||||
const indexedOctree<treeDataCell>& tree = cellTree();
|
||||
|
||||
scalar span = tree.bb().mag();
|
||||
|
||||
// Search with decent span
|
||||
pointIndexHit info = tree.findNearest(location, Foam::sqr(span));
|
||||
pointIndexHit info = tree.findNearest
|
||||
(
|
||||
location,
|
||||
magSqr(tree.bb().max()-tree.bb().min())
|
||||
);
|
||||
|
||||
if (!info.hit())
|
||||
{
|
||||
@ -767,12 +771,10 @@ Foam::label Foam::meshSearch::findNearestBoundaryFace
|
||||
{
|
||||
const indexedOctree<treeDataFace>& tree = boundaryTree();
|
||||
|
||||
scalar span = tree.bb().mag();
|
||||
|
||||
pointIndexHit info = boundaryTree().findNearest
|
||||
(
|
||||
location,
|
||||
Foam::sqr(span)
|
||||
magSqr(tree.bb().max()-tree.bb().min())
|
||||
);
|
||||
|
||||
if (!info.hit())
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -135,7 +135,7 @@ void Foam::regionToCell::combine(topoSet& set, const bool add) const
|
||||
"regionToCell::combine(topoSet&, const bool) const"
|
||||
) << "Point " << insidePoint_
|
||||
<< " is not inside the mesh." << nl
|
||||
<< "Bounding box of the mesh:" << mesh_.globalData().bb()
|
||||
<< "Bounding box of the mesh:" << mesh_.bounds()
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ set -x
|
||||
wmakeLnInclude decompositionMethods
|
||||
|
||||
wmake libso scotchDecomp
|
||||
wmake libso metisDecomp
|
||||
|
||||
if [ -d "$FOAM_LIBBIN/$FOAM_MPI" ]
|
||||
then
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -75,6 +75,14 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells
|
||||
labelList allDist(dist);
|
||||
map.distribute(allDist);
|
||||
|
||||
// Now we have:
|
||||
// oldToNew : the locally-compact numbering of all our cellCells. -1 if
|
||||
// cellCell is not in set.
|
||||
// allDist : destination domain for all our cellCells
|
||||
// subCellCells : indexes into oldToNew and allDist
|
||||
|
||||
// Globally compact numbering for cells in set.
|
||||
globalIndex globalSubCells(set.size());
|
||||
|
||||
// Now subCellCells contains indices into oldToNew which are the
|
||||
// new locations of the neighbouring cells.
|
||||
@ -90,14 +98,23 @@ void Foam::multiLevelDecomp::subsetGlobalCellCells
|
||||
label newI = 0;
|
||||
forAll(cCells, i)
|
||||
{
|
||||
label subCellI = oldToNew[cCells[i]];
|
||||
if (subCellI == -1)
|
||||
// Get locally-compact cell index of neighbouring cell
|
||||
label nbrCellI = oldToNew[cCells[i]];
|
||||
if (nbrCellI == -1)
|
||||
{
|
||||
cutConnections[allDist[cCells[i]]]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
cCells[newI++] = subCellI;
|
||||
// Reconvert local cell index into global one
|
||||
|
||||
// Get original neighbour
|
||||
label cellI = set[subCellI];
|
||||
label oldNbrCellI = cellCells[cellI][i];
|
||||
// Get processor from original neighbour
|
||||
label procI = globalCells.whichProcID(oldNbrCellI);
|
||||
// Convert into global compact numbering
|
||||
cCells[newI++] = globalSubCells.toGlobal(procI, nbrCellI);
|
||||
}
|
||||
}
|
||||
cCells.setSize(newI);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,6 @@ License
|
||||
|
||||
#include "structuredDecomp.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "IFstream.H"
|
||||
#include "FaceCellWave.H"
|
||||
#include "topoDistanceData.H"
|
||||
#include "fvMeshSubset.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -102,6 +102,14 @@ License
|
||||
}
|
||||
|
||||
|
||||
|
||||
Note: writes out .dgr files for debugging. Run with e.g.
|
||||
|
||||
mpirun -np 4 dgpart 2 'processor%r.grf'
|
||||
|
||||
- %r gets replaced by current processor rank
|
||||
- decompose into 2 domains
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ptscotchDecomp.H"
|
||||
@ -161,6 +169,7 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str)
|
||||
//- Does prevention of 0 cell domains and calls ptscotch.
|
||||
Foam::label Foam::ptscotchDecomp::decomposeZeroDomains
|
||||
(
|
||||
const fileName& meshPath,
|
||||
const List<int>& initadjncy,
|
||||
const List<int>& initxadj,
|
||||
const scalarField& initcWeights,
|
||||
@ -184,6 +193,7 @@ Foam::label Foam::ptscotchDecomp::decomposeZeroDomains
|
||||
{
|
||||
return decompose
|
||||
(
|
||||
meshPath,
|
||||
initadjncy,
|
||||
initxadj,
|
||||
initcWeights,
|
||||
@ -287,7 +297,7 @@ Foam::label Foam::ptscotchDecomp::decomposeZeroDomains
|
||||
|
||||
|
||||
// Do decomposition as normal. Sets finalDecomp.
|
||||
label result = decompose(adjncy, xadj, cWeights, finalDecomp);
|
||||
label result = decompose(meshPath, adjncy, xadj, cWeights, finalDecomp);
|
||||
|
||||
|
||||
if (debug)
|
||||
@ -344,6 +354,7 @@ Foam::label Foam::ptscotchDecomp::decomposeZeroDomains
|
||||
// Call scotch with options from dictionary.
|
||||
Foam::label Foam::ptscotchDecomp::decompose
|
||||
(
|
||||
const fileName& meshPath,
|
||||
const List<int>& adjncy,
|
||||
const List<int>& xadj,
|
||||
const scalarField& cWeights,
|
||||
@ -356,58 +367,82 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
Pout<< "ptscotchDecomp : entering with xadj:" << xadj.size() << endl;
|
||||
}
|
||||
|
||||
// // Dump graph
|
||||
// if (decompositionDict_.found("ptscotchCoeffs"))
|
||||
// {
|
||||
// const dictionary& scotchCoeffs =
|
||||
// decompositionDict_.subDict("ptscotchCoeffs");
|
||||
//
|
||||
// if (scotchCoeffs.lookupOrDefault("writeGraph", false))
|
||||
// {
|
||||
// OFstream str(mesh_.time().path() / mesh_.name() + ".grf");
|
||||
//
|
||||
// Info<< "Dumping Scotch graph file to " << str.name() << endl
|
||||
// << "Use this in combination with gpart." << endl;
|
||||
//
|
||||
// // Distributed graph file (.grf)
|
||||
// label version = 2;
|
||||
// str << version << nl;
|
||||
// // Number of files
|
||||
|
||||
// // Number of files (procglbnbr)
|
||||
// str << Pstream::nProcs();
|
||||
// // My file number (procloc)
|
||||
// str << ' ' << Pstream::myProcNo() << nl;
|
||||
//
|
||||
// // Total number of vertices (vertglbnbr)
|
||||
// str << returnReduce(mesh.nCells(), sumOp<label>());
|
||||
// // Total number of connections (edgeglbnbr)
|
||||
// str << ' ' << returnReduce(xadj[mesh.nCells()], sumOp<label>())
|
||||
// << nl;
|
||||
// // Local number of vertices (vertlocnbr)
|
||||
// str << mesh.nCells();
|
||||
// // Local number of connections (edgelocnbr)
|
||||
// str << ' ' << xadj[mesh.nCells()] << nl;
|
||||
// // Numbering starts from 0
|
||||
// label baseval = 0;
|
||||
// // Start of my global vertices (procdsptab[proclocnum])
|
||||
// str << ' ' << globalCells.toGlobal(0);
|
||||
// 100*hasVertlabels+10*hasEdgeWeights+1*hasVertWeighs
|
||||
// str << ' ' << "0" << nl;
|
||||
// for (label cellI = 0; cellI < xadj.size()-1; cellI++)
|
||||
// {
|
||||
// label start = xadj[cellI];
|
||||
// label end = xadj[cellI+1];
|
||||
// str << end-start;
|
||||
//
|
||||
// for (label i = start; i < end; i++)
|
||||
// {
|
||||
// str << ' ' << adjncy[i];
|
||||
// }
|
||||
// str << nl;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "nProcessors_:" << nProcessors_ << endl;
|
||||
|
||||
globalIndex globalCells(xadj.size()-1);
|
||||
|
||||
Pout<< "Xadj:" << endl;
|
||||
for (label cellI = 0; cellI < xadj.size()-1; cellI++)
|
||||
{
|
||||
Pout<< "cell:" << cellI
|
||||
<< " global:" << globalCells.toGlobal(cellI)
|
||||
<< " connected to:" << endl;
|
||||
label start = xadj[cellI];
|
||||
label end = xadj[cellI+1];
|
||||
for (label i = start; i < end; i++)
|
||||
{
|
||||
Pout<< " cell:" << adjncy[i] << endl;
|
||||
}
|
||||
}
|
||||
Pout<< endl;
|
||||
}
|
||||
|
||||
// Dump graph
|
||||
if (decompositionDict_.found("ptscotchCoeffs"))
|
||||
{
|
||||
const dictionary& scotchCoeffs =
|
||||
decompositionDict_.subDict("ptscotchCoeffs");
|
||||
|
||||
if (scotchCoeffs.lookupOrDefault("writeGraph", false))
|
||||
{
|
||||
OFstream str
|
||||
(
|
||||
meshPath + "_" + Foam::name(Pstream::myProcNo()) + ".dgr"
|
||||
);
|
||||
|
||||
Pout<< "Dumping Scotch graph file to " << str.name() << endl
|
||||
<< "Use this in combination with dgpart." << endl;
|
||||
|
||||
globalIndex globalCells(xadj.size()-1);
|
||||
|
||||
// Distributed graph file (.grf)
|
||||
label version = 2;
|
||||
str << version << nl;
|
||||
// Number of files (procglbnbr)
|
||||
str << Pstream::nProcs();
|
||||
// My file number (procloc)
|
||||
str << ' ' << Pstream::myProcNo() << nl;
|
||||
|
||||
// Total number of vertices (vertglbnbr)
|
||||
str << globalCells.size();
|
||||
// Total number of connections (edgeglbnbr)
|
||||
str << ' ' << returnReduce(xadj[xadj.size()-1], sumOp<label>())
|
||||
<< nl;
|
||||
// Local number of vertices (vertlocnbr)
|
||||
str << xadj.size()-1;
|
||||
// Local number of connections (edgelocnbr)
|
||||
str << ' ' << xadj[xadj.size()-1] << nl;
|
||||
// Numbering starts from 0
|
||||
label baseval = 0;
|
||||
// 100*hasVertlabels+10*hasEdgeWeights+1*hasVertWeighs
|
||||
str << baseval << ' ' << "000" << nl;
|
||||
for (label cellI = 0; cellI < xadj.size()-1; cellI++)
|
||||
{
|
||||
label start = xadj[cellI];
|
||||
label end = xadj[cellI+1];
|
||||
str << end-start;
|
||||
|
||||
for (label i = start; i < end; i++)
|
||||
{
|
||||
str << ' ' << adjncy[i];
|
||||
}
|
||||
str << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Strategy
|
||||
// ~~~~~~~~
|
||||
@ -487,7 +522,7 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "SCOTCH_dgraphBuild with:" << nl
|
||||
<< "xadj.size() : " << xadj.size()-1 << nl
|
||||
<< "xadj.size()-1 : " << xadj.size()-1 << nl
|
||||
<< "xadj : " << long(xadj.begin()) << nl
|
||||
<< "velotab : " << long(velotab.begin()) << nl
|
||||
<< "adjncy.size() : " << adjncy.size() << nl
|
||||
@ -693,6 +728,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
||||
List<int> finalDecomp;
|
||||
decomposeZeroDomains
|
||||
(
|
||||
mesh.time().path()/mesh.name(),
|
||||
cellCells.m(),
|
||||
cellCells.offsets(),
|
||||
pointWeights,
|
||||
@ -744,6 +780,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
||||
List<int> finalDecomp;
|
||||
decomposeZeroDomains
|
||||
(
|
||||
mesh.time().path()/mesh.name(),
|
||||
cellCells.m(),
|
||||
cellCells.offsets(),
|
||||
pointWeights,
|
||||
@ -797,6 +834,7 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
||||
List<int> finalDecomp;
|
||||
decomposeZeroDomains
|
||||
(
|
||||
"ptscotch",
|
||||
cellCells.m(),
|
||||
cellCells.offsets(),
|
||||
cWeights,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -63,6 +63,7 @@ class ptscotchDecomp
|
||||
//- Decompose with optionally zero sized domains
|
||||
label decomposeZeroDomains
|
||||
(
|
||||
const fileName& meshPath,
|
||||
const List<int>& initadjncy,
|
||||
const List<int>& initxadj,
|
||||
const scalarField& initcWeights,
|
||||
@ -72,6 +73,7 @@ class ptscotchDecomp
|
||||
//- Decompose
|
||||
label decompose
|
||||
(
|
||||
const fileName& meshPath,
|
||||
const List<int>& adjncy,
|
||||
const List<int>& xadj,
|
||||
const scalarField& cWeights,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -182,7 +182,7 @@ bool Foam::streamLineParticle::move
|
||||
td.keepParticle = true;
|
||||
|
||||
scalar tEnd = (1.0 - stepFraction())*trackTime;
|
||||
scalar dtMax = tEnd;
|
||||
scalar maxDt = cloud_.pMesh().bounds().mag();
|
||||
|
||||
while
|
||||
(
|
||||
@ -192,7 +192,7 @@ bool Foam::streamLineParticle::move
|
||||
)
|
||||
{
|
||||
// set the lagrangian time-step
|
||||
scalar dt = min(dtMax, tEnd);
|
||||
scalar dt = maxDt;
|
||||
|
||||
// Cross cell in steps:
|
||||
// - at subiter 0 calculate dt to cross cell in nSubCycle steps
|
||||
@ -210,6 +210,16 @@ bool Foam::streamLineParticle::move
|
||||
U = -U;
|
||||
}
|
||||
|
||||
scalar magU = mag(U);
|
||||
|
||||
if (magU < SMALL)
|
||||
{
|
||||
// Stagnant particle. Might as well stop
|
||||
lifeTime_ = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
U /= magU;
|
||||
|
||||
if (subIter == 0 && td.nSubCycle_ > 1)
|
||||
{
|
||||
@ -219,7 +229,7 @@ bool Foam::streamLineParticle::move
|
||||
else if (subIter == td.nSubCycle_ - 1)
|
||||
{
|
||||
// Do full step on last subcycle
|
||||
dt = min(dtMax, tEnd);
|
||||
dt = maxDt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -341,7 +341,7 @@ bool Foam::sampledSurfaces::update()
|
||||
}
|
||||
|
||||
// dimension as fraction of mesh bounding box
|
||||
scalar mergeDim = mergeTol_ * mesh_.globalData().bb().mag();
|
||||
scalar mergeDim = mergeTol_ * mesh_.bounds().mag();
|
||||
|
||||
if (Pstream::master() && debug)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "Tuple2.H"
|
||||
#include "globalIndex.H"
|
||||
#include "treeDataCell.H"
|
||||
#include "treeDataFace.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -43,6 +44,17 @@ namespace Foam
|
||||
word
|
||||
);
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<sampledTriSurfaceMesh::samplingSource, 2>::names[] =
|
||||
{
|
||||
"cells",
|
||||
"boundaryFaces"
|
||||
};
|
||||
|
||||
const NamedEnum<sampledTriSurfaceMesh::samplingSource, 2>
|
||||
sampledTriSurfaceMesh::samplingSourceNames_;
|
||||
|
||||
|
||||
//- Private class for finding nearest
|
||||
// - global index
|
||||
// - sqr(distance)
|
||||
@ -70,7 +82,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const word& surfaceName
|
||||
const word& surfaceName,
|
||||
const samplingSource sampleSource
|
||||
)
|
||||
:
|
||||
sampledSurface(name, mesh),
|
||||
@ -78,7 +91,7 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
surfaceName,
|
||||
mesh.time().constant(), // instance
|
||||
"triSurface", // local
|
||||
mesh, // registry
|
||||
@ -87,9 +100,10 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||
false
|
||||
)
|
||||
),
|
||||
sampleSource_(sampleSource),
|
||||
needsUpdate_(true),
|
||||
cellLabels_(0),
|
||||
pointToFace_(0)
|
||||
sampleElements_(0),
|
||||
samplePoints_(0)
|
||||
{}
|
||||
|
||||
|
||||
@ -114,9 +128,10 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
|
||||
false
|
||||
)
|
||||
),
|
||||
sampleSource_(samplingSourceNames_[dict.lookup("source")]),
|
||||
needsUpdate_(true),
|
||||
cellLabels_(0),
|
||||
pointToFace_(0)
|
||||
sampleElements_(0),
|
||||
samplePoints_(0)
|
||||
{}
|
||||
|
||||
|
||||
@ -144,8 +159,8 @@ bool Foam::sampledTriSurfaceMesh::expire()
|
||||
|
||||
sampledSurface::clearGeom();
|
||||
MeshStorage::clear();
|
||||
cellLabels_.clear();
|
||||
pointToFace_.clear();
|
||||
sampleElements_.clear();
|
||||
samplePoints_.clear();
|
||||
|
||||
needsUpdate_ = true;
|
||||
return true;
|
||||
@ -164,43 +179,79 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
// Does approximation by looking at the face centres only
|
||||
const pointField& fc = surface_.faceCentres();
|
||||
|
||||
// Mesh search engine, no triangulation of faces.
|
||||
meshSearch meshSearcher(mesh(), false);
|
||||
|
||||
const indexedOctree<treeDataCell>& cellTree = meshSearcher.cellTree();
|
||||
|
||||
|
||||
// Global numbering for cells - only used to uniquely identify local cells.
|
||||
globalIndex globalCells(mesh().nCells());
|
||||
List<nearInfo> nearest(fc.size());
|
||||
|
||||
// Global numbering for cells/faces - only used to uniquely identify local
|
||||
// elements
|
||||
globalIndex globalCells
|
||||
(
|
||||
sampleSource_ == cells
|
||||
? mesh().nCells()
|
||||
: mesh().nFaces()
|
||||
);
|
||||
|
||||
forAll(nearest, i)
|
||||
{
|
||||
nearest[i].first() = GREAT;
|
||||
nearest[i].second() = labelMax;
|
||||
}
|
||||
|
||||
// Search triangles using nearest on local mesh
|
||||
forAll(fc, triI)
|
||||
if (sampleSource_ == cells)
|
||||
{
|
||||
pointIndexHit nearInfo = cellTree.findNearest
|
||||
(
|
||||
fc[triI],
|
||||
sqr(GREAT)
|
||||
);
|
||||
if (nearInfo.hit())
|
||||
// Search for nearest cell
|
||||
|
||||
const indexedOctree<treeDataCell>& cellTree = meshSearcher.cellTree();
|
||||
|
||||
forAll(fc, triI)
|
||||
{
|
||||
nearest[triI].first() = magSqr(nearInfo.hitPoint()-fc[triI]);
|
||||
nearest[triI].second() = globalCells.toGlobal(nearInfo.index());
|
||||
pointIndexHit nearInfo = cellTree.findNearest
|
||||
(
|
||||
fc[triI],
|
||||
sqr(GREAT)
|
||||
);
|
||||
if (nearInfo.hit())
|
||||
{
|
||||
nearest[triI].first() = magSqr(nearInfo.hitPoint()-fc[triI]);
|
||||
nearest[triI].second() = globalCells.toGlobal(nearInfo.index());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Search for nearest boundaryFace
|
||||
|
||||
const indexedOctree<treeDataFace>& bTree = meshSearcher.boundaryTree();
|
||||
|
||||
forAll(fc, triI)
|
||||
{
|
||||
pointIndexHit nearInfo = bTree.findNearest
|
||||
(
|
||||
fc[triI],
|
||||
sqr(GREAT)
|
||||
);
|
||||
if (nearInfo.hit())
|
||||
{
|
||||
nearest[triI].first() = magSqr(nearInfo.hitPoint()-fc[triI]);
|
||||
nearest[triI].second() = globalCells.toGlobal
|
||||
(
|
||||
bTree.shapes().faceLabels()[nearInfo.index()]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// See which processor has the nearest.
|
||||
|
||||
// See which processor has the nearest. Mark and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Pstream::listCombineGather(nearest, nearestEqOp());
|
||||
Pstream::listCombineScatter(nearest);
|
||||
|
||||
boolList include(surface_.size(), false);
|
||||
|
||||
cellLabels_.setSize(fc.size());
|
||||
cellLabels_ = -1;
|
||||
labelList cellOrFaceLabels(fc.size(), -1);
|
||||
|
||||
label nFound = 0;
|
||||
forAll(nearest, triI)
|
||||
@ -211,9 +262,10 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
}
|
||||
else if (globalCells.isLocal(nearest[triI].second()))
|
||||
{
|
||||
cellLabels_[triI] = globalCells.toLocal(nearest[triI].second());
|
||||
|
||||
include[triI] = true;
|
||||
cellOrFaceLabels[triI] = globalCells.toLocal
|
||||
(
|
||||
nearest[triI].second()
|
||||
);
|
||||
nFound++;
|
||||
}
|
||||
}
|
||||
@ -221,7 +273,7 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Local out of faces:" << cellLabels_.size()
|
||||
Pout<< "Local out of faces:" << cellOrFaceLabels.size()
|
||||
<< " keeping:" << nFound << endl;
|
||||
}
|
||||
|
||||
@ -243,7 +295,7 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
|
||||
forAll(s, faceI)
|
||||
{
|
||||
if (include[faceI])
|
||||
if (cellOrFaceLabels[faceI] != -1)
|
||||
{
|
||||
faceMap[newFaceI++] = faceI;
|
||||
|
||||
@ -262,11 +314,12 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
pointMap.setSize(newPointI);
|
||||
}
|
||||
|
||||
// Subset cellLabels
|
||||
cellLabels_ = UIndirectList<label>(cellLabels_, faceMap)();
|
||||
|
||||
// Store any face per point
|
||||
pointToFace_.setSize(pointMap.size());
|
||||
// Subset cellOrFaceLabels
|
||||
cellOrFaceLabels = UIndirectList<label>(cellOrFaceLabels, faceMap)();
|
||||
|
||||
// Store any face per point (without using pointFaces())
|
||||
labelList pointToFace(pointMap.size());
|
||||
|
||||
// Create faces and points for subsetted surface
|
||||
faceList& faces = this->storedFaces();
|
||||
@ -284,7 +337,7 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
|
||||
forAll(newF, fp)
|
||||
{
|
||||
pointToFace_[newF[fp]] = i;
|
||||
pointToFace[newF[fp]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,6 +349,161 @@ bool Foam::sampledTriSurfaceMesh::update()
|
||||
Pout<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Collect the samplePoints and sampleElements
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (sampledSurface::interpolate())
|
||||
{
|
||||
samplePoints_.setSize(pointMap.size());
|
||||
sampleElements_.setSize(pointMap.size(), -1);
|
||||
|
||||
if (sampleSource_ == cells)
|
||||
{
|
||||
// samplePoints_ : per surface point a location inside the cell
|
||||
// sampleElements_ : per surface point the cell
|
||||
|
||||
forAll(points(), pointI)
|
||||
{
|
||||
const point& pt = points()[pointI];
|
||||
label cellI = cellOrFaceLabels[pointToFace[pointI]];
|
||||
sampleElements_[pointI] = cellI;
|
||||
|
||||
// Check if point inside cell
|
||||
if (mesh().pointInCell(pt, sampleElements_[pointI]))
|
||||
{
|
||||
samplePoints_[pointI] = pt;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find nearest point on faces of cell
|
||||
const cell& cFaces = mesh().cells()[cellI];
|
||||
|
||||
scalar minDistSqr = VGREAT;
|
||||
|
||||
forAll(cFaces, i)
|
||||
{
|
||||
const face& f = mesh().faces()[cFaces[i]];
|
||||
pointHit info = f.nearestPoint(pt, mesh().points());
|
||||
if (info.distance() < minDistSqr)
|
||||
{
|
||||
minDistSqr = info.distance();
|
||||
samplePoints_[pointI] = info.rawPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// samplePoints_ : per surface point a location on the boundary
|
||||
// sampleElements_ : per surface point the boundary face containing
|
||||
// the location
|
||||
|
||||
forAll(points(), pointI)
|
||||
{
|
||||
const point& pt = points()[pointI];
|
||||
label faceI = cellOrFaceLabels[pointToFace[pointI]];
|
||||
sampleElements_[pointI] = faceI;
|
||||
samplePoints_[pointI] = mesh().faces()[faceI].nearestPoint
|
||||
(
|
||||
pt,
|
||||
mesh().points()
|
||||
).rawPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if sampleSource_ == cells:
|
||||
// samplePoints_ : n/a
|
||||
// sampleElements_ : per surface triangle the cell
|
||||
// else:
|
||||
// samplePoints_ : n/a
|
||||
// sampleElements_ : per surface triangle the boundary face
|
||||
samplePoints_.clear();
|
||||
sampleElements_.transfer(cellOrFaceLabels);
|
||||
}
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
this->clearOut();
|
||||
OFstream str(mesh().time().path()/"surfaceToMesh.obj");
|
||||
Info<< "Dumping correspondence from local surface (points or faces)"
|
||||
<< " to mesh (cells or faces) to " << str.name() << endl;
|
||||
label vertI = 0;
|
||||
|
||||
if (sampledSurface::interpolate())
|
||||
{
|
||||
if (sampleSource_ == cells)
|
||||
{
|
||||
forAll(samplePoints_, pointI)
|
||||
{
|
||||
meshTools::writeOBJ(str, points()[pointI]);
|
||||
vertI++;
|
||||
|
||||
meshTools::writeOBJ(str, samplePoints_[pointI]);
|
||||
vertI++;
|
||||
|
||||
label cellI = sampleElements_[pointI];
|
||||
meshTools::writeOBJ(str, mesh().cellCentres()[cellI]);
|
||||
vertI++;
|
||||
str << "l " << vertI-2 << ' ' << vertI-1 << ' ' << vertI
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(samplePoints_, pointI)
|
||||
{
|
||||
meshTools::writeOBJ(str, points()[pointI]);
|
||||
vertI++;
|
||||
|
||||
meshTools::writeOBJ(str, samplePoints_[pointI]);
|
||||
vertI++;
|
||||
|
||||
label faceI = sampleElements_[pointI];
|
||||
meshTools::writeOBJ(str, mesh().faceCentres()[faceI]);
|
||||
vertI++;
|
||||
str << "l " << vertI-2 << ' ' << vertI-1 << ' ' << vertI
|
||||
<< nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sampleSource_ == cells)
|
||||
{
|
||||
forAll(sampleElements_, triI)
|
||||
{
|
||||
meshTools::writeOBJ(str, faceCentres()[triI]);
|
||||
vertI++;
|
||||
|
||||
label cellI = sampleElements_[triI];
|
||||
meshTools::writeOBJ(str, mesh().cellCentres()[cellI]);
|
||||
vertI++;
|
||||
str << "l " << vertI-1 << ' ' << vertI << nl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(sampleElements_, triI)
|
||||
{
|
||||
meshTools::writeOBJ(str, faceCentres()[triI]);
|
||||
vertI++;
|
||||
|
||||
label faceI = sampleElements_[triI];
|
||||
meshTools::writeOBJ(str, mesh().faceCentres()[faceI]);
|
||||
vertI++;
|
||||
str << "l " << vertI-1 << ' ' << vertI << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
needsUpdate_ = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,22 +61,38 @@ class sampledTriSurfaceMesh
|
||||
public sampledSurface,
|
||||
public MeshedSurface<face>
|
||||
{
|
||||
public:
|
||||
//- Types of communications
|
||||
enum samplingSource
|
||||
{
|
||||
cells,
|
||||
boundaryFaces
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
//- Private typedefs for convenience
|
||||
typedef MeshedSurface<face> MeshStorage;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
static const NamedEnum<samplingSource, 2> samplingSourceNames_;
|
||||
|
||||
//- Surface to sample on
|
||||
const triSurfaceMesh surface_;
|
||||
|
||||
//- Whether to sample internal cell values or boundary values
|
||||
const samplingSource sampleSource_;
|
||||
|
||||
//- Track if the surface needs an update
|
||||
mutable bool needsUpdate_;
|
||||
|
||||
//- From local surface triangle to mesh cell.
|
||||
labelList cellLabels_;
|
||||
//- From local surface triangle to mesh cell/face.
|
||||
labelList sampleElements_;
|
||||
|
||||
//- From local surface back to surface_
|
||||
labelList pointToFace_;
|
||||
//- Local points to sample per point
|
||||
pointField samplePoints_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -106,7 +122,8 @@ public:
|
||||
(
|
||||
const word& name,
|
||||
const polyMesh& mesh,
|
||||
const word& surfaceName
|
||||
const word& surfaceName,
|
||||
const samplingSource sampleSource
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,12 +35,48 @@ Foam::sampledTriSurfaceMesh::sampleField
|
||||
) const
|
||||
{
|
||||
// One value per face
|
||||
tmp<Field<Type> > tvalues(new Field<Type>(cellLabels_.size()));
|
||||
tmp<Field<Type> > tvalues(new Field<Type>(sampleElements_.size()));
|
||||
Field<Type>& values = tvalues();
|
||||
|
||||
forAll(cellLabels_, triI)
|
||||
if (sampleSource_ == cells)
|
||||
{
|
||||
values[triI] = vField[cellLabels_[triI]];
|
||||
// Sample cells
|
||||
|
||||
forAll(sampleElements_, triI)
|
||||
{
|
||||
values[triI] = vField[sampleElements_[triI]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sample boundary faces
|
||||
|
||||
const polyBoundaryMesh& pbm = mesh().boundaryMesh();
|
||||
label nBnd = mesh().nFaces()-mesh().nInternalFaces();
|
||||
|
||||
// Create flat boundary field
|
||||
|
||||
Field<Type> bVals(nBnd, pTraits<Type>::zero);
|
||||
|
||||
forAll(vField.boundaryField(), patchI)
|
||||
{
|
||||
label bFaceI = pbm[patchI].start() - mesh().nInternalFaces();
|
||||
|
||||
SubList<Type>
|
||||
(
|
||||
bVals,
|
||||
vField.boundaryField()[patchI].size(),
|
||||
bFaceI
|
||||
).assign(vField.boundaryField()[patchI]);
|
||||
}
|
||||
|
||||
// Sample in flat boundary field
|
||||
|
||||
forAll(sampleElements_, triI)
|
||||
{
|
||||
label faceI = sampleElements_[triI];
|
||||
values[triI] = bVals[faceI-mesh().nInternalFaces()];
|
||||
}
|
||||
}
|
||||
|
||||
return tvalues;
|
||||
@ -55,15 +91,37 @@ Foam::sampledTriSurfaceMesh::interpolateField
|
||||
) const
|
||||
{
|
||||
// One value per vertex
|
||||
tmp<Field<Type> > tvalues(new Field<Type>(pointToFace_.size()));
|
||||
tmp<Field<Type> > tvalues(new Field<Type>(sampleElements_.size()));
|
||||
Field<Type>& values = tvalues();
|
||||
|
||||
forAll(pointToFace_, pointI)
|
||||
if (sampleSource_ == cells)
|
||||
{
|
||||
label triI = pointToFace_[pointI];
|
||||
label cellI = cellLabels_[triI];
|
||||
// Sample cells.
|
||||
|
||||
values[pointI] = interpolator.interpolate(points()[pointI], cellI);
|
||||
forAll(sampleElements_, pointI)
|
||||
{
|
||||
values[pointI] = interpolator.interpolate
|
||||
(
|
||||
samplePoints_[pointI],
|
||||
sampleElements_[pointI]
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sample boundary faces.
|
||||
|
||||
forAll(samplePoints_, pointI)
|
||||
{
|
||||
label faceI = sampleElements_[pointI];
|
||||
|
||||
values[pointI] = interpolator.interpolate
|
||||
(
|
||||
samplePoints_[pointI],
|
||||
mesh().faceOwner()[faceI],
|
||||
faceI
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return tvalues;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -151,6 +151,11 @@ bool Foam::triSurface::stitchTriangles
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can happen for e.g. single triangle or cloud of unconnected triangles
|
||||
storedPoints() = rawPoints;
|
||||
}
|
||||
|
||||
return hasMerged;
|
||||
}
|
||||
|
||||
@ -11,5 +11,5 @@ mv log.setSet log.wallFilmRegion.setSet
|
||||
runApplication setsToZones -noFlipMap
|
||||
mv log.setsToZones log.setsToZones.primaryRegion
|
||||
|
||||
runApplication extrudeToRegionMesh wallFilmRegion '(wallFilmFaces)' 0.01 -overwrite
|
||||
runApplication extrudeToRegionMesh -overwrite
|
||||
|
||||
|
||||
@ -18,70 +18,6 @@ FoamFile
|
||||
solution
|
||||
{
|
||||
active false;
|
||||
|
||||
integrationSchemes
|
||||
{
|
||||
U Euler;
|
||||
T Analytical;
|
||||
}
|
||||
}
|
||||
|
||||
constantProperties
|
||||
{
|
||||
parcelTypeId 1;
|
||||
|
||||
rhoMin 1e-15;
|
||||
TMin 200;
|
||||
pMin 1000;
|
||||
minParticleMass 1e-15;
|
||||
|
||||
rho0 1000;
|
||||
T0 300;
|
||||
Cp0 4187;
|
||||
|
||||
epsilon0 1;
|
||||
f0 0.5;
|
||||
|
||||
Pr 0.7;
|
||||
Tvap 273;
|
||||
Tbp 373;
|
||||
youngsModulus 0;
|
||||
poissonsRatio 0;
|
||||
|
||||
constantVolume false;
|
||||
}
|
||||
|
||||
particleForces
|
||||
{
|
||||
gravity on;
|
||||
virtualMass off;
|
||||
pressureGradient off;
|
||||
paramagnetic off;
|
||||
}
|
||||
|
||||
subModels
|
||||
{
|
||||
InjectionModel none;
|
||||
|
||||
DragModel none;
|
||||
|
||||
DispersionModel none;
|
||||
|
||||
PatchInteractionModel none;
|
||||
|
||||
CollisionModel none;
|
||||
|
||||
HeatTransferModel none;
|
||||
|
||||
CompositionModel none;
|
||||
|
||||
PhaseChangeModel none;
|
||||
|
||||
PostProcessingModel none;
|
||||
|
||||
SurfaceFilmModel none;
|
||||
|
||||
radiation off;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object extrudeToRegionMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
region wallFilmRegion;
|
||||
|
||||
faceZones (wallFilmFaces);
|
||||
|
||||
adaptMesh true;
|
||||
|
||||
oneD false;
|
||||
|
||||
extrudeModel linearNormal;
|
||||
|
||||
nLayers 1;
|
||||
|
||||
expansionRatio 1;
|
||||
|
||||
linearNormalCoeffs
|
||||
{
|
||||
thickness 0.01;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -6,7 +6,7 @@ runApplication blockMesh
|
||||
runApplication setSet -batch wallFilmRegion.setSet
|
||||
mv log.setSet log.wallFilmRegion.setSet
|
||||
|
||||
runApplication extrudeToRegionMesh wallFilmRegion '(wallFilmFaces)' 0.01 -overwrite
|
||||
runApplication extrudeToRegionMesh -overwrite
|
||||
|
||||
runApplication setSet -region wallFilmRegion -batch createWallFilmRegionPatches.setSet
|
||||
mv log.setSet log.createWallFilmRegionPatches.setSet
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
@ -18,70 +18,6 @@ FoamFile
|
||||
solution
|
||||
{
|
||||
active false;
|
||||
|
||||
integrationSchemes
|
||||
{
|
||||
U Euler;
|
||||
T Analytical;
|
||||
}
|
||||
}
|
||||
|
||||
constantProperties
|
||||
{
|
||||
parcelTypeId 1;
|
||||
|
||||
rhoMin 1e-15;
|
||||
TMin 200;
|
||||
pMin 1000;
|
||||
minParticleMass 1e-15;
|
||||
|
||||
rho0 1000;
|
||||
T0 300;
|
||||
Cp0 4187;
|
||||
|
||||
youngsModulus 1e9;
|
||||
poissonsRatio 0.35;
|
||||
|
||||
epsilon0 1;
|
||||
f0 0.5;
|
||||
Pr 0.7;
|
||||
Tvap 273;
|
||||
Tbp 373;
|
||||
|
||||
constantVolume false;
|
||||
}
|
||||
|
||||
particleForces
|
||||
{
|
||||
gravity on;
|
||||
virtualMass off;
|
||||
pressureGradient off;
|
||||
paramagnetic off;
|
||||
}
|
||||
|
||||
subModels
|
||||
{
|
||||
InjectionModel none;
|
||||
|
||||
DragModel none;
|
||||
|
||||
DispersionModel none;
|
||||
|
||||
PatchInteractionModel none;
|
||||
|
||||
HeatTransferModel none;
|
||||
|
||||
CompositionModel none;
|
||||
|
||||
PhaseChangeModel none;
|
||||
|
||||
PostProcessingModel none;
|
||||
|
||||
CollisionModel none;
|
||||
|
||||
SurfaceFilmModel none;
|
||||
|
||||
radiation off;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object extrudeToRegionMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
region wallFilmRegion;
|
||||
|
||||
faceZones (wallFilmFaces);
|
||||
|
||||
adaptMesh true;
|
||||
|
||||
oneD false;
|
||||
|
||||
extrudeModel linearNormal;
|
||||
|
||||
nLayers 1;
|
||||
|
||||
expansionRatio 1;
|
||||
|
||||
linearNormalCoeffs
|
||||
{
|
||||
thickness 0.01;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Reference in New Issue
Block a user