mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
|
||||||
while (runTime.run())
|
while (runTime.loop())
|
||||||
{
|
{
|
||||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||||
|
|
||||||
@ -81,8 +81,6 @@ int main(int argc, char *argv[])
|
|||||||
#include "convergenceCheck.H"
|
#include "convergenceCheck.H"
|
||||||
}
|
}
|
||||||
|
|
||||||
runTime++;
|
|
||||||
|
|
||||||
runTime.write();
|
runTime.write();
|
||||||
|
|
||||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
|
|||||||
@ -53,7 +53,7 @@ int main(int argc, char *argv[])
|
|||||||
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
|
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
|
||||||
|
|
||||||
|
|
||||||
// Test:print shared points
|
// Test:print (collocated) shared points
|
||||||
{
|
{
|
||||||
const labelListList& globalPointSlaves =
|
const labelListList& globalPointSlaves =
|
||||||
globalData.globalPointSlaves();
|
globalData.globalPointSlaves();
|
||||||
@ -90,7 +90,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Test: point to faces addressing
|
// Test: (collocated) point to faces addressing
|
||||||
{
|
{
|
||||||
const labelListList& globalPointBoundaryFaces =
|
const labelListList& globalPointBoundaryFaces =
|
||||||
globalData.globalPointBoundaryFaces();
|
globalData.globalPointBoundaryFaces();
|
||||||
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Test:point to cells addressing
|
// Test:(collocated) point to cells addressing
|
||||||
{
|
{
|
||||||
const labelList& boundaryCells = globalData.boundaryCells();
|
const labelList& boundaryCells = globalData.boundaryCells();
|
||||||
const labelListList& globalPointBoundaryCells =
|
const labelListList& globalPointBoundaryCells =
|
||||||
@ -172,7 +172,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Test:print shared edges
|
// Test:print (collocated) shared edges
|
||||||
{
|
{
|
||||||
const labelListList& globalEdgeSlaves =
|
const labelListList& globalEdgeSlaves =
|
||||||
globalData.globalEdgeSlaves();
|
globalData.globalEdgeSlaves();
|
||||||
|
|||||||
@ -46,9 +46,6 @@ Usage
|
|||||||
@param -fields \n
|
@param -fields \n
|
||||||
Use existing geometry decomposition and convert fields only.
|
Use existing geometry decomposition and convert fields only.
|
||||||
|
|
||||||
@param -filterPatches \n
|
|
||||||
Remove empty patches when decomposing the geometry.
|
|
||||||
|
|
||||||
@param -force \n
|
@param -force \n
|
||||||
Remove any existing @a processor subdirectories before decomposing the
|
Remove any existing @a processor subdirectories before decomposing the
|
||||||
geometry.
|
geometry.
|
||||||
@ -99,11 +96,6 @@ int main(int argc, char *argv[])
|
|||||||
"use existing geometry decomposition and convert fields only"
|
"use existing geometry decomposition and convert fields only"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
|
||||||
"filterPatches",
|
|
||||||
"remove empty patches when decomposing the geometry"
|
|
||||||
);
|
|
||||||
argList::addBoolOption
|
|
||||||
(
|
(
|
||||||
"force",
|
"force",
|
||||||
"remove existing processor*/ subdirs before decomposing the geometry"
|
"remove existing processor*/ subdirs before decomposing the geometry"
|
||||||
@ -128,7 +120,6 @@ int main(int argc, char *argv[])
|
|||||||
bool writeCellDist = args.optionFound("cellDist");
|
bool writeCellDist = args.optionFound("cellDist");
|
||||||
bool copyUniform = args.optionFound("copyUniform");
|
bool copyUniform = args.optionFound("copyUniform");
|
||||||
bool decomposeFieldsOnly = args.optionFound("fields");
|
bool decomposeFieldsOnly = args.optionFound("fields");
|
||||||
bool filterPatches = args.optionFound("filterPatches");
|
|
||||||
bool forceOverwrite = args.optionFound("force");
|
bool forceOverwrite = args.optionFound("force");
|
||||||
bool ifRequiredDecomposition = args.optionFound("ifRequired");
|
bool ifRequiredDecomposition = args.optionFound("ifRequired");
|
||||||
|
|
||||||
@ -249,7 +240,7 @@ int main(int argc, char *argv[])
|
|||||||
// Decompose the mesh
|
// Decompose the mesh
|
||||||
if (!decomposeFieldsOnly)
|
if (!decomposeFieldsOnly)
|
||||||
{
|
{
|
||||||
mesh.decomposeMesh(filterPatches);
|
mesh.decomposeMesh();
|
||||||
|
|
||||||
mesh.writeDecomposition();
|
mesh.writeDecomposition();
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,24 @@ void Foam::domainDecomposition::mark
|
|||||||
Foam::domainDecomposition::domainDecomposition(const IOobject& io)
|
Foam::domainDecomposition::domainDecomposition(const IOobject& io)
|
||||||
:
|
:
|
||||||
fvMesh(io),
|
fvMesh(io),
|
||||||
|
facesInstancePointsPtr_
|
||||||
|
(
|
||||||
|
pointsInstance() != facesInstance()
|
||||||
|
? new pointIOField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"points",
|
||||||
|
facesInstance(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
*this,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
: NULL
|
||||||
|
),
|
||||||
decompositionDict_
|
decompositionDict_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -86,7 +104,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io)
|
|||||||
procPointAddressing_(nProcs_),
|
procPointAddressing_(nProcs_),
|
||||||
procFaceAddressing_(nProcs_),
|
procFaceAddressing_(nProcs_),
|
||||||
procCellAddressing_(nProcs_),
|
procCellAddressing_(nProcs_),
|
||||||
procBoundaryAddressing_(nProcs_),
|
|
||||||
procPatchSize_(nProcs_),
|
procPatchSize_(nProcs_),
|
||||||
procPatchStartIndex_(nProcs_),
|
procPatchStartIndex_(nProcs_),
|
||||||
procNeighbourProcessors_(nProcs_),
|
procNeighbourProcessors_(nProcs_),
|
||||||
@ -263,24 +280,67 @@ bool Foam::domainDecomposition::writeDecomposition()
|
|||||||
"system",
|
"system",
|
||||||
"constant"
|
"constant"
|
||||||
);
|
);
|
||||||
|
processorDb.setTime(time());
|
||||||
|
|
||||||
// create the mesh
|
// create the mesh. Two situations:
|
||||||
polyMesh procMesh
|
// - points and faces come from the same time ('instance'). The mesh
|
||||||
|
// will get constructed in the same instance.
|
||||||
|
// - points come from a different time (moving mesh cases).
|
||||||
|
// It will read the points belonging to the faces instance and
|
||||||
|
// construct the procMesh with it which then gets handled as above.
|
||||||
|
// (so with 'old' geometry).
|
||||||
|
// Only at writing time will it additionally write the current
|
||||||
|
// points.
|
||||||
|
|
||||||
|
autoPtr<polyMesh> procMeshPtr;
|
||||||
|
|
||||||
|
if (facesInstancePointsPtr_.valid())
|
||||||
|
{
|
||||||
|
// Construct mesh from facesInstance.
|
||||||
|
pointField facesInstancePoints
|
||||||
|
(
|
||||||
|
facesInstancePointsPtr_(),
|
||||||
|
curPointLabels
|
||||||
|
);
|
||||||
|
|
||||||
|
procMeshPtr.reset
|
||||||
|
(
|
||||||
|
new polyMesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
this->polyMesh::name(), // region name of undecomposed mesh
|
this->polyMesh::name(), // region of undecomposed mesh
|
||||||
pointsInstance(),
|
facesInstance(),
|
||||||
|
processorDb
|
||||||
|
),
|
||||||
|
xferMove(facesInstancePoints),
|
||||||
|
xferMove(procFaces),
|
||||||
|
xferMove(procCells)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
procMeshPtr.reset
|
||||||
|
(
|
||||||
|
new polyMesh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
this->polyMesh::name(), // region of undecomposed mesh
|
||||||
|
facesInstance(),
|
||||||
processorDb
|
processorDb
|
||||||
),
|
),
|
||||||
xferMove(procPoints),
|
xferMove(procPoints),
|
||||||
xferMove(procFaces),
|
xferMove(procFaces),
|
||||||
xferMove(procCells)
|
xferMove(procCells)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
polyMesh& procMesh = procMeshPtr();
|
||||||
|
|
||||||
|
|
||||||
// Create processor boundary patches
|
// Create processor boundary patches
|
||||||
const labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
|
|
||||||
|
|
||||||
const labelList& curPatchSizes = procPatchSize_[procI];
|
const labelList& curPatchSizes = procPatchSize_[procI];
|
||||||
|
|
||||||
const labelList& curPatchStarts = procPatchStartIndex_[procI];
|
const labelList& curPatchStarts = procPatchStartIndex_[procI];
|
||||||
@ -309,8 +369,7 @@ bool Foam::domainDecomposition::writeDecomposition()
|
|||||||
{
|
{
|
||||||
// Get the face labels consistent with the field mapping
|
// Get the face labels consistent with the field mapping
|
||||||
// (reuse the patch field mappers)
|
// (reuse the patch field mappers)
|
||||||
const polyPatch& meshPatch =
|
const polyPatch& meshPatch = meshPatches[patchi];
|
||||||
meshPatches[curBoundaryAddressing[patchi]];
|
|
||||||
|
|
||||||
fvFieldDecomposer::patchFieldDecomposer patchMapper
|
fvFieldDecomposer::patchFieldDecomposer patchMapper
|
||||||
(
|
(
|
||||||
@ -324,8 +383,7 @@ bool Foam::domainDecomposition::writeDecomposition()
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Map existing patches
|
// Map existing patches
|
||||||
procPatches[nPatches] =
|
procPatches[nPatches] = meshPatch.clone
|
||||||
meshPatches[curBoundaryAddressing[patchi]].clone
|
|
||||||
(
|
(
|
||||||
procMesh.boundaryMesh(),
|
procMesh.boundaryMesh(),
|
||||||
nPatches,
|
nPatches,
|
||||||
@ -589,6 +647,26 @@ bool Foam::domainDecomposition::writeDecomposition()
|
|||||||
|
|
||||||
procMesh.write();
|
procMesh.write();
|
||||||
|
|
||||||
|
// Write points if pointsInstance differing from facesInstance
|
||||||
|
if (facesInstancePointsPtr_.valid())
|
||||||
|
{
|
||||||
|
pointIOField pointsInstancePoints
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"points",
|
||||||
|
pointsInstance(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
procMesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
xferMove(procPoints)
|
||||||
|
);
|
||||||
|
pointsInstancePoints.write();
|
||||||
|
}
|
||||||
|
|
||||||
Info<< endl
|
Info<< endl
|
||||||
<< "Processor " << procI << nl
|
<< "Processor " << procI << nl
|
||||||
<< " Number of cells = " << procMesh.nCells()
|
<< " Number of cells = " << procMesh.nCells()
|
||||||
@ -678,6 +756,16 @@ bool Foam::domainDecomposition::writeDecomposition()
|
|||||||
);
|
);
|
||||||
cellProcAddressing.write();
|
cellProcAddressing.write();
|
||||||
|
|
||||||
|
// Write patch map for backwards compatibility.
|
||||||
|
// (= identity map for original patches, -1 for processor patches)
|
||||||
|
label nMeshPatches = curPatchSizes.size();
|
||||||
|
labelList procBoundaryAddressing(identity(nMeshPatches));
|
||||||
|
procBoundaryAddressing.setSize
|
||||||
|
(
|
||||||
|
nMeshPatches+curProcessorPatchSizes.size(),
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
|
||||||
labelIOList boundaryProcAddressing
|
labelIOList boundaryProcAddressing
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -689,7 +777,7 @@ bool Foam::domainDecomposition::writeDecomposition()
|
|||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
procBoundaryAddressing_[procI]
|
procBoundaryAddressing
|
||||||
);
|
);
|
||||||
boundaryProcAddressing.write();
|
boundaryProcAddressing.write();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,9 @@ class domainDecomposition
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
//- Optional: points at the facesInstance
|
||||||
|
autoPtr<pointIOField> facesInstancePointsPtr_;
|
||||||
|
|
||||||
//- Mesh decomposition control dictionary
|
//- Mesh decomposition control dictionary
|
||||||
IOdictionary decompositionDict_;
|
IOdictionary decompositionDict_;
|
||||||
|
|
||||||
@ -83,9 +86,6 @@ class domainDecomposition
|
|||||||
//- Labels of cells for each processor
|
//- Labels of cells for each processor
|
||||||
labelListList procCellAddressing_;
|
labelListList procCellAddressing_;
|
||||||
|
|
||||||
//- Original patch index for every processor patch
|
|
||||||
labelListList procBoundaryAddressing_;
|
|
||||||
|
|
||||||
//- Sizes for processor mesh patches
|
//- Sizes for processor mesh patches
|
||||||
// Excludes inter-processor boundaries
|
// Excludes inter-processor boundaries
|
||||||
labelListList procPatchSize_;
|
labelListList procPatchSize_;
|
||||||
@ -149,8 +149,8 @@ public:
|
|||||||
return distributed_;
|
return distributed_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Decompose mesh. Optionally remove zero-sized patches.
|
//- Decompose mesh.
|
||||||
void decomposeMesh(const bool filterEmptyPatches);
|
void decomposeMesh();
|
||||||
|
|
||||||
//- Write decomposition
|
//- Write decomposition
|
||||||
bool writeDecomposition();
|
bool writeDecomposition();
|
||||||
|
|||||||
@ -40,7 +40,7 @@ Description
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
void Foam::domainDecomposition::decomposeMesh()
|
||||||
{
|
{
|
||||||
// Decide which cell goes to which processor
|
// Decide which cell goes to which processor
|
||||||
distributeCells();
|
distributeCells();
|
||||||
@ -598,64 +598,6 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "\nCalculating processor boundary addressing" << endl;
|
|
||||||
// For every patch of processor boundary, find the index of the original
|
|
||||||
// patch. Mis-alignment is caused by the fact that patches with zero size
|
|
||||||
// are omitted. For processor patches, set index to -1.
|
|
||||||
// At the same time, filter the procPatchSize_ and procPatchStartIndex_
|
|
||||||
// lists to exclude zero-size patches
|
|
||||||
forAll(procPatchSize_, procI)
|
|
||||||
{
|
|
||||||
// Make a local copy of old lists
|
|
||||||
const labelList oldPatchSizes = procPatchSize_[procI];
|
|
||||||
|
|
||||||
const labelList oldPatchStarts = procPatchStartIndex_[procI];
|
|
||||||
|
|
||||||
labelList& curPatchSizes = procPatchSize_[procI];
|
|
||||||
|
|
||||||
labelList& curPatchStarts = procPatchStartIndex_[procI];
|
|
||||||
|
|
||||||
const labelList& curProcessorPatchSizes =
|
|
||||||
procProcessorPatchSize_[procI];
|
|
||||||
|
|
||||||
labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
|
|
||||||
|
|
||||||
curBoundaryAddressing.setSize
|
|
||||||
(
|
|
||||||
oldPatchSizes.size()
|
|
||||||
+ curProcessorPatchSizes.size()
|
|
||||||
);
|
|
||||||
|
|
||||||
label nPatches = 0;
|
|
||||||
|
|
||||||
forAll(oldPatchSizes, patchi)
|
|
||||||
{
|
|
||||||
if (!filterEmptyPatches || oldPatchSizes[patchi] > 0)
|
|
||||||
{
|
|
||||||
curBoundaryAddressing[nPatches] = patchi;
|
|
||||||
|
|
||||||
curPatchSizes[nPatches] = oldPatchSizes[patchi];
|
|
||||||
|
|
||||||
curPatchStarts[nPatches] = oldPatchStarts[patchi];
|
|
||||||
|
|
||||||
nPatches++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// reset to the size of live patches
|
|
||||||
curPatchSizes.setSize(nPatches);
|
|
||||||
curPatchStarts.setSize(nPatches);
|
|
||||||
|
|
||||||
forAll(curProcessorPatchSizes, procPatchI)
|
|
||||||
{
|
|
||||||
curBoundaryAddressing[nPatches] = -1;
|
|
||||||
|
|
||||||
nPatches++;
|
|
||||||
}
|
|
||||||
|
|
||||||
curBoundaryAddressing.setSize(nPatches);
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "\nDistributing points to processors" << endl;
|
Info<< "\nDistributing points to processors" << endl;
|
||||||
// For every processor, loop through the list of faces for the processor.
|
// For every processor, loop through the list of faces for the processor.
|
||||||
// For every face, loop through the list of points and mark the point as
|
// For every face, loop through the list of points and mark the point as
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// ignore special fields or fields that we don't handle
|
// ignore special fields or fields that we don't handle
|
||||||
//
|
//
|
||||||
bool variableGood = true;
|
bool variableGood = true;
|
||||||
for (label n1=startTime; n1<endTime && variableGood; ++n1)
|
for (label n1=0; n1<Times.size() && variableGood; ++n1)
|
||||||
{
|
{
|
||||||
// ignore _0 fields
|
// ignore _0 fields
|
||||||
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
|
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
|
||||||
|
|||||||
@ -19,7 +19,7 @@ if (Pstream::master())
|
|||||||
Info<< "Correcting time values. Adding " << Tcorr << endl;
|
Info<< "Correcting time values. Adding " << Tcorr << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int n=startTime; n<endTime; n++)
|
forAll(Times, n)
|
||||||
{
|
{
|
||||||
ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " ";
|
ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " ";
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,6 @@ void writeAllFaceData
|
|||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const Field<Type>& pf,
|
const Field<Type>& pf,
|
||||||
const labelList& patchProcessors,
|
|
||||||
OFstream& ensightFile
|
OFstream& ensightFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -199,11 +198,8 @@ void writeAllFaceData
|
|||||||
{
|
{
|
||||||
writeData(map(pf, prims, cmpt), ensightFile);
|
writeData(map(pf, prims, cmpt), ensightFile);
|
||||||
|
|
||||||
forAll(patchProcessors, i)
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
if (patchProcessors[i] != 0)
|
|
||||||
{
|
|
||||||
label slave = patchProcessors[i];
|
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
scalarField pf(fromSlave);
|
scalarField pf(fromSlave);
|
||||||
|
|
||||||
@ -211,7 +207,6 @@ void writeAllFaceData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||||
@ -231,7 +226,6 @@ void writeAllFaceDataBinary
|
|||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const Field<Type>& pf,
|
const Field<Type>& pf,
|
||||||
const labelList& patchProcessors,
|
|
||||||
std::ofstream& ensightFile
|
std::ofstream& ensightFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -245,11 +239,8 @@ void writeAllFaceDataBinary
|
|||||||
{
|
{
|
||||||
writeEnsDataBinary(map(pf, prims, cmpt), ensightFile);
|
writeEnsDataBinary(map(pf, prims, cmpt), ensightFile);
|
||||||
|
|
||||||
forAll(patchProcessors, i)
|
for (int slave=1; slave<Pstream::nProcs(); slave++)
|
||||||
{
|
{
|
||||||
if (patchProcessors[i] != 0)
|
|
||||||
{
|
|
||||||
label slave = patchProcessors[i];
|
|
||||||
IPstream fromSlave(Pstream::scheduled, slave);
|
IPstream fromSlave(Pstream::scheduled, slave);
|
||||||
scalarField pf(fromSlave);
|
scalarField pf(fromSlave);
|
||||||
|
|
||||||
@ -257,7 +248,6 @@ void writeAllFaceDataBinary
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
|
||||||
@ -278,7 +268,6 @@ bool writePatchField
|
|||||||
const Foam::label ensightPatchI,
|
const Foam::label ensightPatchI,
|
||||||
const Foam::faceSets& boundaryFaceSet,
|
const Foam::faceSets& boundaryFaceSet,
|
||||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
const Foam::ensightMesh::nFacePrimitives& nfp,
|
||||||
const Foam::labelList& patchProcessors,
|
|
||||||
Foam::OFstream& ensightFile
|
Foam::OFstream& ensightFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -297,7 +286,6 @@ bool writePatchField
|
|||||||
boundaryFaceSet.tris,
|
boundaryFaceSet.tris,
|
||||||
nfp.nTris,
|
nfp.nTris,
|
||||||
pf,
|
pf,
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -307,7 +295,6 @@ bool writePatchField
|
|||||||
boundaryFaceSet.quads,
|
boundaryFaceSet.quads,
|
||||||
nfp.nQuads,
|
nfp.nQuads,
|
||||||
pf,
|
pf,
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -317,7 +304,6 @@ bool writePatchField
|
|||||||
boundaryFaceSet.polys,
|
boundaryFaceSet.polys,
|
||||||
nfp.nPolys,
|
nfp.nPolys,
|
||||||
pf,
|
pf,
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -338,7 +324,6 @@ bool writePatchFieldBinary
|
|||||||
const Foam::label ensightPatchI,
|
const Foam::label ensightPatchI,
|
||||||
const Foam::faceSets& boundaryFaceSet,
|
const Foam::faceSets& boundaryFaceSet,
|
||||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
const Foam::ensightMesh::nFacePrimitives& nfp,
|
||||||
const Foam::labelList& patchProcessors,
|
|
||||||
std::ofstream& ensightFile
|
std::ofstream& ensightFile
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -356,7 +341,6 @@ bool writePatchFieldBinary
|
|||||||
boundaryFaceSet.tris,
|
boundaryFaceSet.tris,
|
||||||
nfp.nTris,
|
nfp.nTris,
|
||||||
pf,
|
pf,
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -366,7 +350,6 @@ bool writePatchFieldBinary
|
|||||||
boundaryFaceSet.quads,
|
boundaryFaceSet.quads,
|
||||||
nfp.nQuads,
|
nfp.nQuads,
|
||||||
pf,
|
pf,
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -376,7 +359,6 @@ bool writePatchFieldBinary
|
|||||||
boundaryFaceSet.polys,
|
boundaryFaceSet.polys,
|
||||||
nfp.nPolys,
|
nfp.nPolys,
|
||||||
pf,
|
pf,
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -406,7 +388,6 @@ void writePatchField
|
|||||||
|
|
||||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
|
||||||
const HashTable<ensightMesh::nFacePrimitives>&
|
const HashTable<ensightMesh::nFacePrimitives>&
|
||||||
nPatchPrims = eMesh.nPatchPrims();
|
nPatchPrims = eMesh.nPatchPrims();
|
||||||
|
|
||||||
@ -425,8 +406,6 @@ void writePatchField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
|
||||||
|
|
||||||
word pfName = patchName + '.' + fieldName;
|
word pfName = patchName + '.' + fieldName;
|
||||||
|
|
||||||
word timeFile = prepend + itoa(timeIndex);
|
word timeFile = prepend + itoa(timeIndex);
|
||||||
@ -473,7 +452,6 @@ void writePatchField
|
|||||||
ensightPatchI,
|
ensightPatchI,
|
||||||
boundaryFaceSets[patchi],
|
boundaryFaceSets[patchi],
|
||||||
nPatchPrims.find(patchName)(),
|
nPatchPrims.find(patchName)(),
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -488,7 +466,6 @@ void writePatchField
|
|||||||
ensightPatchI,
|
ensightPatchI,
|
||||||
nullFaceSets,
|
nullFaceSets,
|
||||||
nPatchPrims.find(patchName)(),
|
nPatchPrims.find(patchName)(),
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -521,7 +498,6 @@ void ensightFieldAscii
|
|||||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
const cellSets& meshCellSets = eMesh.meshCellSets();
|
||||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
|
||||||
const wordHashSet& patchNames = eMesh.patchNames();
|
const wordHashSet& patchNames = eMesh.patchNames();
|
||||||
const HashTable<ensightMesh::nFacePrimitives>&
|
const HashTable<ensightMesh::nFacePrimitives>&
|
||||||
nPatchPrims = eMesh.nPatchPrims();
|
nPatchPrims = eMesh.nPatchPrims();
|
||||||
@ -619,11 +595,8 @@ void ensightFieldAscii
|
|||||||
forAll(allPatchNames, patchi)
|
forAll(allPatchNames, patchi)
|
||||||
{
|
{
|
||||||
const word& patchName = allPatchNames[patchi];
|
const word& patchName = allPatchNames[patchi];
|
||||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
|
||||||
|
|
||||||
if (patchNames.empty() || patchNames.found(patchName))
|
if (patchNames.empty() || patchNames.found(patchName))
|
||||||
{
|
|
||||||
if (mesh.boundary()[patchi].size())
|
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -634,36 +607,12 @@ void ensightFieldAscii
|
|||||||
ensightPatchI,
|
ensightPatchI,
|
||||||
boundaryFaceSets[patchi],
|
boundaryFaceSets[patchi],
|
||||||
nPatchPrims.find(patchName)(),
|
nPatchPrims.find(patchName)(),
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ensightPatchI++;
|
ensightPatchI++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else if (Pstream::master())
|
|
||||||
{
|
|
||||||
faceSets nullFaceSet;
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
writePatchField
|
|
||||||
(
|
|
||||||
Field<Type>(),
|
|
||||||
-1,
|
|
||||||
ensightPatchI,
|
|
||||||
nullFaceSet,
|
|
||||||
nPatchPrims.find(patchName)(),
|
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ensightPatchI++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +644,6 @@ void ensightFieldBinary
|
|||||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
const cellSets& meshCellSets = eMesh.meshCellSets();
|
||||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
|
||||||
const wordHashSet& patchNames = eMesh.patchNames();
|
const wordHashSet& patchNames = eMesh.patchNames();
|
||||||
const HashTable<ensightMesh::nFacePrimitives>&
|
const HashTable<ensightMesh::nFacePrimitives>&
|
||||||
nPatchPrims = eMesh.nPatchPrims();
|
nPatchPrims = eMesh.nPatchPrims();
|
||||||
@ -819,11 +767,8 @@ void ensightFieldBinary
|
|||||||
forAll(allPatchNames, patchi)
|
forAll(allPatchNames, patchi)
|
||||||
{
|
{
|
||||||
const word& patchName = allPatchNames[patchi];
|
const word& patchName = allPatchNames[patchi];
|
||||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
|
||||||
|
|
||||||
if (patchNames.empty() || patchNames.found(patchName))
|
if (patchNames.empty() || patchNames.found(patchName))
|
||||||
{
|
|
||||||
if (mesh.boundary()[patchi].size())
|
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -834,36 +779,12 @@ void ensightFieldBinary
|
|||||||
ensightPatchI,
|
ensightPatchI,
|
||||||
boundaryFaceSets[patchi],
|
boundaryFaceSets[patchi],
|
||||||
nPatchPrims.find(patchName)(),
|
nPatchPrims.find(patchName)(),
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
ensightFile
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ensightPatchI++;
|
ensightPatchI++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else if (Pstream::master())
|
|
||||||
{
|
|
||||||
faceSets nullFaceSet;
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
writePatchFieldBinary
|
|
||||||
(
|
|
||||||
Field<Type>(),
|
|
||||||
-1,
|
|
||||||
ensightPatchI,
|
|
||||||
nullFaceSet,
|
|
||||||
nPatchPrims.find(patchName)(),
|
|
||||||
patchProcessors,
|
|
||||||
ensightFile
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
ensightPatchI++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,7 @@ SourceFiles
|
|||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include "globalIndex.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -62,14 +63,12 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
label nPoints;
|
|
||||||
label nTris;
|
label nTris;
|
||||||
label nQuads;
|
label nQuads;
|
||||||
label nPolys;
|
label nPolys;
|
||||||
|
|
||||||
nFacePrimitives()
|
nFacePrimitives()
|
||||||
:
|
:
|
||||||
nPoints(0),
|
|
||||||
nTris(0),
|
nTris(0),
|
||||||
nQuads(0),
|
nQuads(0),
|
||||||
nPolys(0)
|
nPolys(0)
|
||||||
@ -95,8 +94,6 @@ private:
|
|||||||
|
|
||||||
wordList allPatchNames_;
|
wordList allPatchNames_;
|
||||||
|
|
||||||
List<labelList> allPatchProcs_;
|
|
||||||
|
|
||||||
wordHashSet patchNames_;
|
wordHashSet patchNames_;
|
||||||
|
|
||||||
HashTable<nFacePrimitives> nPatchPrims_;
|
HashTable<nFacePrimitives> nPatchPrims_;
|
||||||
@ -119,20 +116,21 @@ private:
|
|||||||
cellShapeList map
|
cellShapeList map
|
||||||
(
|
(
|
||||||
const cellShapeList& cellShapes,
|
const cellShapeList& cellShapes,
|
||||||
const labelList& prims
|
const labelList& prims,
|
||||||
|
const labelList& pointToGlobal
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
cellShapeList map
|
cellShapeList map
|
||||||
(
|
(
|
||||||
const cellShapeList& cellShapes,
|
const cellShapeList& cellShapes,
|
||||||
const labelList& hexes,
|
const labelList& hexes,
|
||||||
const labelList& wedges
|
const labelList& wedges,
|
||||||
|
const labelList& pointToGlobal
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writePrims
|
void writePrims
|
||||||
(
|
(
|
||||||
const cellShapeList& cellShapes,
|
const cellShapeList& cellShapes,
|
||||||
const label pointOffset,
|
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -156,13 +154,12 @@ private:
|
|||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const label pointOffset,
|
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeAllPolys
|
void writeAllPolys
|
||||||
(
|
(
|
||||||
const labelList& pointOffsets,
|
const labelList& pointToGlobal,
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -171,31 +168,21 @@ private:
|
|||||||
const char* key,
|
const char* key,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const cellShapeList& cellShapes,
|
const cellShapeList& cellShapes,
|
||||||
const labelList& pointOffsets,
|
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeFacePrims
|
void writeFacePrims
|
||||||
(
|
(
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const label pointOffset,
|
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
faceList map
|
|
||||||
(
|
|
||||||
const faceList& patchFaces,
|
|
||||||
const labelList& prims
|
|
||||||
) const;
|
|
||||||
|
|
||||||
void writeAllFacePrims
|
void writeAllFacePrims
|
||||||
(
|
(
|
||||||
const char* key,
|
const char* key,
|
||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const labelList& pointOffsets,
|
|
||||||
const labelList& patchProcessors,
|
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -208,7 +195,6 @@ private:
|
|||||||
void writeNSidedPoints
|
void writeNSidedPoints
|
||||||
(
|
(
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const label pointOffset,
|
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -217,8 +203,6 @@ private:
|
|||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const labelList& pointOffsets,
|
|
||||||
const labelList& patchProcessors,
|
|
||||||
OFstream& ensightGeometryFile
|
OFstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -227,7 +211,10 @@ private:
|
|||||||
const fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const word& prepend,
|
const word& prepend,
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile,
|
||||||
|
const labelList& pointToGlobal,
|
||||||
|
const pointField& uniquePoints,
|
||||||
|
const globalIndex& globalPoints
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeBinary
|
void writeBinary
|
||||||
@ -235,13 +222,15 @@ private:
|
|||||||
const fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const word& prepend,
|
const word& prepend,
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile,
|
||||||
|
const labelList& pointToGlobal,
|
||||||
|
const pointField& uniquePoints,
|
||||||
|
const globalIndex& globalPoints
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writePrimsBinary
|
void writePrimsBinary
|
||||||
(
|
(
|
||||||
const cellShapeList& cellShapes,
|
const cellShapeList& cellShapes,
|
||||||
const label pointOffset,
|
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -250,7 +239,6 @@ private:
|
|||||||
const char* key,
|
const char* key,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const cellShapeList& cellShapes,
|
const cellShapeList& cellShapes,
|
||||||
const labelList& pointOffsets,
|
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -274,13 +262,12 @@ private:
|
|||||||
const labelList& polys,
|
const labelList& polys,
|
||||||
const cellList& cellFaces,
|
const cellList& cellFaces,
|
||||||
const faceList& faces,
|
const faceList& faces,
|
||||||
const label pointOffset,
|
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeAllPolysBinary
|
void writeAllPolysBinary
|
||||||
(
|
(
|
||||||
const labelList& pointOffsets,
|
const labelList& pointToGlobal,
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -290,22 +277,18 @@ private:
|
|||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const labelList& pointOffsets,
|
|
||||||
const labelList& patchProcessors,
|
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeFacePrimsBinary
|
void writeFacePrimsBinary
|
||||||
(
|
(
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const label pointOffset,
|
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
void writeNSidedPointsBinary
|
void writeNSidedPointsBinary
|
||||||
(
|
(
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const label pointOffset,
|
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -320,8 +303,6 @@ private:
|
|||||||
const labelList& prims,
|
const labelList& prims,
|
||||||
const label nPrims,
|
const label nPrims,
|
||||||
const faceList& patchFaces,
|
const faceList& patchFaces,
|
||||||
const labelList& pointOffsets,
|
|
||||||
const labelList& patchProcessors,
|
|
||||||
std::ofstream& ensightGeometryFile
|
std::ofstream& ensightGeometryFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
@ -361,11 +342,6 @@ public:
|
|||||||
return allPatchNames_;
|
return allPatchNames_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const List<labelList>& allPatchProcs() const
|
|
||||||
{
|
|
||||||
return allPatchProcs_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wordHashSet& patchNames() const
|
const wordHashSet& patchNames() const
|
||||||
{
|
{
|
||||||
return patchNames_;
|
return patchNames_;
|
||||||
|
|||||||
@ -93,6 +93,9 @@ bool inFileNameList
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
timeSelector::addOptions();
|
||||||
|
# include "addRegionOption.H"
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"ascii",
|
"ascii",
|
||||||
@ -111,7 +114,6 @@ int main(int argc, char *argv[])
|
|||||||
"An empty list suppresses writing the internalMesh."
|
"An empty list suppresses writing the internalMesh."
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "addTimeOptions.H"
|
|
||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
|
|
||||||
// Check options
|
// Check options
|
||||||
@ -119,12 +121,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
// get the available time-steps
|
instantList Times = timeSelector::select0(runTime, args);
|
||||||
instantList Times = runTime.times();
|
|
||||||
|
|
||||||
# include "checkTimeOptions.H"
|
|
||||||
|
|
||||||
runTime.setTime(Times[startTime], startTime);
|
|
||||||
|
|
||||||
# include "createNamedMesh.H"
|
# include "createNamedMesh.H"
|
||||||
|
|
||||||
@ -214,9 +211,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Identify if lagrangian data exists at each time, and add clouds
|
// Identify if lagrangian data exists at each time, and add clouds
|
||||||
// to the 'allCloudNames' hash set
|
// to the 'allCloudNames' hash set
|
||||||
for (label n=startTime; n<endTime; n++)
|
forAll(Times, timeI)
|
||||||
{
|
{
|
||||||
runTime.setTime(Times[n], n);
|
runTime.setTime(Times[timeI], timeI);
|
||||||
|
|
||||||
fileNameList cloudDirs = readDir
|
fileNameList cloudDirs = readDir
|
||||||
(
|
(
|
||||||
@ -267,9 +264,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Loop over all times to build list of fields and field types
|
// Loop over all times to build list of fields and field types
|
||||||
// for each cloud
|
// for each cloud
|
||||||
for (label n=startTime; n<endTime; n++)
|
forAll(Times, timeI)
|
||||||
{
|
{
|
||||||
runTime.setTime(Times[n], n);
|
runTime.setTime(Times[timeI], timeI);
|
||||||
|
|
||||||
IOobjectList cloudObjs
|
IOobjectList cloudObjs
|
||||||
(
|
(
|
||||||
@ -296,20 +293,19 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
label nTimeSteps = 0;
|
label nTimeSteps = 0;
|
||||||
for (label n=startTime; n<endTime; n++)
|
forAll(Times, timeIndex)
|
||||||
{
|
{
|
||||||
nTimeSteps++;
|
nTimeSteps++;
|
||||||
runTime.setTime(Times[n], n);
|
runTime.setTime(Times[timeIndex], timeIndex);
|
||||||
label timeIndex = n - startTime;
|
|
||||||
|
|
||||||
word timeName = itoa(timeIndex);
|
word timeName = itoa(timeIndex);
|
||||||
word timeFile = prepend + timeName;
|
word timeFile = prepend + timeName;
|
||||||
|
|
||||||
Info<< "Translating time = " << runTime.timeName() << nl;
|
Info<< "Translating time = " << runTime.timeName() << nl;
|
||||||
|
|
||||||
# include "moveMesh.H"
|
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
||||||
|
|
||||||
if (timeIndex == 0 || mesh.moving())
|
if (timeIndex == 0 || (meshState != polyMesh::UNCHANGED))
|
||||||
{
|
{
|
||||||
eMesh.write
|
eMesh.write
|
||||||
(
|
(
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
IOobject ioPoints
|
|
||||||
(
|
|
||||||
"points",
|
|
||||||
runTime.timeName(),
|
|
||||||
polyMesh::meshSubDir,
|
|
||||||
mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
if (ioPoints.headerOk())
|
|
||||||
{
|
|
||||||
// Reading new points
|
|
||||||
pointIOField newPoints
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"points",
|
|
||||||
mesh.time().timeName(),
|
|
||||||
polyMesh::meshSubDir,
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
mesh.movePoints(newPoints);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
12608
applications/utilities/surface/surfaceInertia/cylinder.obj
Normal file
12608
applications/utilities/surface/surfaceInertia/cylinder.obj
Normal file
File diff suppressed because it is too large
Load Diff
13174
applications/utilities/surface/surfaceInertia/dangermouse.obj
Normal file
13174
applications/utilities/surface/surfaceInertia/dangermouse.obj
Normal file
File diff suppressed because it is too large
Load Diff
261982
applications/utilities/surface/surfaceInertia/sphere.obj
Normal file
261982
applications/utilities/surface/surfaceInertia/sphere.obj
Normal file
File diff suppressed because it is too large
Load Diff
@ -41,6 +41,9 @@ Description
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "Random.H"
|
#include "Random.H"
|
||||||
|
#include "transform.H"
|
||||||
|
#include "IOmanip.H"
|
||||||
|
#include "Pair.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -355,6 +358,12 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m < 0)
|
||||||
|
{
|
||||||
|
WarningIn(args.executable() + "::main")
|
||||||
|
<< "Negative mass detected" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
vector eVal = eigenValues(J);
|
vector eVal = eigenValues(J);
|
||||||
|
|
||||||
tensor eVec = eigenVectors(J);
|
tensor eVec = eigenVectors(J);
|
||||||
@ -380,19 +389,221 @@ int main(int argc, char *argv[])
|
|||||||
pertI++;
|
pertI++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl
|
bool showTransform = true;
|
||||||
<< "Density = " << density << nl
|
|
||||||
<< "Mass = " << m << nl
|
if
|
||||||
<< "Centre of mass = " << cM << nl
|
(
|
||||||
<< "Inertia tensor around centre of mass = " << J << nl
|
(mag(eVec.x() ^ eVec.y()) > (1.0 - SMALL))
|
||||||
<< "eigenValues (principal moments) = " << eVal << nl
|
&& (mag(eVec.y() ^ eVec.z()) > (1.0 - SMALL))
|
||||||
<< "eigenVectors (principal axes) = "
|
&& (mag(eVec.z() ^ eVec.x()) > (1.0 - SMALL))
|
||||||
<< eVec.x() << ' ' << eVec.y() << ' ' << eVec.z()
|
)
|
||||||
|
{
|
||||||
|
// Make the eigenvectors a right handed orthogonal triplet
|
||||||
|
eVec.z() *= sign((eVec.x() ^ eVec.y()) & eVec.z());
|
||||||
|
|
||||||
|
// Finding the most natural transformation. Using Lists
|
||||||
|
// rather than tensors to allow indexed permutation.
|
||||||
|
|
||||||
|
// Cartesian basis vectors - right handed orthogonal triplet
|
||||||
|
List<vector> cartesian(3);
|
||||||
|
|
||||||
|
cartesian[0] = vector(1, 0, 0);
|
||||||
|
cartesian[1] = vector(0, 1, 0);
|
||||||
|
cartesian[2] = vector(0, 0, 1);
|
||||||
|
|
||||||
|
// Principal axis basis vectors - right handed orthogonal
|
||||||
|
// triplet
|
||||||
|
List<vector> principal(3);
|
||||||
|
|
||||||
|
principal[0] = eVec.x();
|
||||||
|
principal[1] = eVec.y();
|
||||||
|
principal[2] = eVec.z();
|
||||||
|
|
||||||
|
scalar maxMagDotProduct = -GREAT;
|
||||||
|
|
||||||
|
// Matching axis indices, first: cartesian, second:principal
|
||||||
|
|
||||||
|
Pair<label> match(-1, -1);
|
||||||
|
|
||||||
|
forAll(cartesian, cI)
|
||||||
|
{
|
||||||
|
forAll(principal, pI)
|
||||||
|
{
|
||||||
|
scalar magDotProduct = mag(cartesian[cI] & principal[pI]);
|
||||||
|
|
||||||
|
if (magDotProduct > maxMagDotProduct)
|
||||||
|
{
|
||||||
|
maxMagDotProduct = magDotProduct;
|
||||||
|
|
||||||
|
match.first() = cI;
|
||||||
|
|
||||||
|
match.second() = pI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar sense = sign
|
||||||
|
(
|
||||||
|
cartesian[match.first()] & principal[match.second()]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (sense < 0)
|
||||||
|
{
|
||||||
|
// Invert the best match direction and swap the order of
|
||||||
|
// the other two vectors
|
||||||
|
|
||||||
|
List<vector> tPrincipal = principal;
|
||||||
|
|
||||||
|
tPrincipal[match.second()] *= -1;
|
||||||
|
|
||||||
|
tPrincipal[(match.second() + 1) % 3] =
|
||||||
|
principal[(match.second() + 2) % 3];
|
||||||
|
|
||||||
|
tPrincipal[(match.second() + 2) % 3] =
|
||||||
|
principal[(match.second() + 1) % 3];
|
||||||
|
|
||||||
|
principal = tPrincipal;
|
||||||
|
|
||||||
|
vector tEVal = eVal;
|
||||||
|
|
||||||
|
tEVal[(match.second() + 1) % 3] = eVal[(match.second() + 2) % 3];
|
||||||
|
|
||||||
|
tEVal[(match.second() + 2) % 3] = eVal[(match.second() + 1) % 3];
|
||||||
|
|
||||||
|
eVal = tEVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
label permutationDelta = match.second() - match.first();
|
||||||
|
|
||||||
|
if (permutationDelta != 0)
|
||||||
|
{
|
||||||
|
// Add 3 to the permutationDelta to avoid negative indices
|
||||||
|
|
||||||
|
permutationDelta += 3;
|
||||||
|
|
||||||
|
List<vector> tPrincipal = principal;
|
||||||
|
|
||||||
|
vector tEVal = eVal;
|
||||||
|
|
||||||
|
for (label i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
tPrincipal[i] = principal[(i + permutationDelta) % 3];
|
||||||
|
|
||||||
|
tEVal[i] = eVal[(i + permutationDelta) % 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
principal = tPrincipal;
|
||||||
|
|
||||||
|
eVal = tEVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
label matchedAlready = match.first();
|
||||||
|
|
||||||
|
match =Pair<label>(-1, -1);
|
||||||
|
|
||||||
|
maxMagDotProduct = -GREAT;
|
||||||
|
|
||||||
|
forAll(cartesian, cI)
|
||||||
|
{
|
||||||
|
if (cI == matchedAlready)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(principal, pI)
|
||||||
|
{
|
||||||
|
if (pI == matchedAlready)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar magDotProduct = mag(cartesian[cI] & principal[pI]);
|
||||||
|
|
||||||
|
if (magDotProduct > maxMagDotProduct)
|
||||||
|
{
|
||||||
|
maxMagDotProduct = magDotProduct;
|
||||||
|
|
||||||
|
match.first() = cI;
|
||||||
|
|
||||||
|
match.second() = pI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sense = sign
|
||||||
|
(
|
||||||
|
cartesian[match.first()] & principal[match.second()]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (sense < 0 || (match.second() - match.first()) != 0)
|
||||||
|
{
|
||||||
|
principal[match.second()] *= -1;
|
||||||
|
|
||||||
|
List<vector> tPrincipal = principal;
|
||||||
|
|
||||||
|
tPrincipal[(matchedAlready + 1) % 3] =
|
||||||
|
principal[(matchedAlready + 2) % 3]*-sense;
|
||||||
|
|
||||||
|
tPrincipal[(matchedAlready + 2) % 3] =
|
||||||
|
principal[(matchedAlready + 1) % 3]*-sense;
|
||||||
|
|
||||||
|
principal = tPrincipal;
|
||||||
|
|
||||||
|
vector tEVal = eVal;
|
||||||
|
|
||||||
|
tEVal[(matchedAlready + 1) % 3] = eVal[(matchedAlready + 2) % 3];
|
||||||
|
|
||||||
|
tEVal[(matchedAlready + 2) % 3] = eVal[(matchedAlready + 1) % 3];
|
||||||
|
|
||||||
|
eVal = tEVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
eVec.x() = principal[0];
|
||||||
|
eVec.y() = principal[1];
|
||||||
|
eVec.z() = principal[2];
|
||||||
|
|
||||||
|
// {
|
||||||
|
// tensor R = rotationTensor(vector(1, 0, 0), eVec.x());
|
||||||
|
|
||||||
|
// R = rotationTensor(R & vector(0, 1, 0), eVec.y()) & R;
|
||||||
|
|
||||||
|
// Info<< "R = " << nl << R << endl;
|
||||||
|
|
||||||
|
// Info<< "R - eVec.T() " << R - eVec.T() << endl;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningIn(args.executable() + "::main")
|
||||||
|
<< "Non-unique eigenvectors, cannot compute transformation "
|
||||||
|
<< "from Cartesian axes" << endl;
|
||||||
|
|
||||||
|
showTransform = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< nl << setprecision(10)
|
||||||
|
<< "Density: " << density << nl
|
||||||
|
<< "Mass: " << m << nl
|
||||||
|
<< "Centre of mass: " << cM << nl
|
||||||
|
<< "Inertia tensor around centre of mass: " << nl << J << nl
|
||||||
|
<< "eigenValues (principal moments): " << eVal << nl
|
||||||
|
<< "eigenVectors (principal axes): " << nl
|
||||||
|
<< eVec.x() << nl << eVec.y() << nl << eVec.z() << endl;
|
||||||
|
|
||||||
|
if (showTransform)
|
||||||
|
{
|
||||||
|
Info<< "Transform tensor from reference state (Q). " << nl
|
||||||
|
<< "Rotation tensor required to transform "
|
||||||
|
"from the body reference frame to the global "
|
||||||
|
"reference frame, i.e.:" << nl
|
||||||
|
<< "globalVector = Q & bodyLocalVector"
|
||||||
|
<< nl << eVec.T()
|
||||||
<< endl;
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (calcAroundRefPt)
|
if (calcAroundRefPt)
|
||||||
{
|
{
|
||||||
Info << "Inertia tensor relative to " << refPt << " = "
|
Info << "Inertia tensor relative to " << refPt << ": "
|
||||||
<< applyParallelAxisTheorem(m, cM, J, refPt)
|
<< applyParallelAxisTheorem(m, cM, J, refPt)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -676,6 +676,10 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
|
|
||||||
deltaT0_ = deltaTSave_;
|
deltaT0_ = deltaTSave_;
|
||||||
deltaTSave_ = deltaT_;
|
deltaTSave_ = deltaT_;
|
||||||
|
|
||||||
|
// Save old time name
|
||||||
|
const word oldTimeName = dimensionedScalar::name();
|
||||||
|
|
||||||
setTime(value() + deltaT_, timeIndex_ + 1);
|
setTime(value() + deltaT_, timeIndex_ + 1);
|
||||||
|
|
||||||
if (!subCycling_)
|
if (!subCycling_)
|
||||||
@ -685,7 +689,30 @@ Foam::Time& Foam::Time::operator++()
|
|||||||
{
|
{
|
||||||
setTime(0.0, timeIndex_);
|
setTime(0.0, timeIndex_);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check that new time representation differs from old one
|
||||||
|
if (dimensionedScalar::name() == oldTimeName)
|
||||||
|
{
|
||||||
|
int oldPrecision = precision_;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
precision_++;
|
||||||
|
setTime(value(), timeIndex());
|
||||||
|
}
|
||||||
|
while (precision_ < 100 && dimensionedScalar::name() == oldTimeName);
|
||||||
|
|
||||||
|
WarningIn("Time::operator++()")
|
||||||
|
<< "Increased the timePrecision from " << oldPrecision
|
||||||
|
<< " to " << precision_
|
||||||
|
<< " to distinguish between timeNames at time " << value()
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!subCycling_)
|
||||||
|
{
|
||||||
switch (writeControl_)
|
switch (writeControl_)
|
||||||
{
|
{
|
||||||
case wcTimeStep:
|
case wcTimeStep:
|
||||||
|
|||||||
@ -410,33 +410,30 @@ Foam::label Foam::globalMeshData::countCoincidentFaces
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::globalMeshData::calcGlobalPointSlaves() const
|
void Foam::globalMeshData::calcGlobalPointSlaves
|
||||||
|
(
|
||||||
|
const globalPoints& globalData,
|
||||||
|
autoPtr<globalIndex>& globalIndicesPtr,
|
||||||
|
autoPtr<labelListList>& globalPointSlavesPtr,
|
||||||
|
autoPtr<mapDistribute>& globalPointSlavesMapPtr
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
Pout<< "globalMeshData::calcGlobalPointSlaves() :"
|
|
||||||
<< " calculating coupled master to slave point addressing."
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate connected points for master points
|
|
||||||
globalPoints globalData(mesh_, coupledPatch(), true);
|
|
||||||
|
|
||||||
const Map<label>& meshToProcPoint = globalData.meshToProcPoint();
|
|
||||||
|
|
||||||
// Create global numbering for coupled points
|
// Create global numbering for coupled points
|
||||||
globalPointNumberingPtr_.reset
|
globalIndicesPtr.reset
|
||||||
(
|
(
|
||||||
new globalIndex(globalData.globalIndices())
|
new globalIndex(globalData.globalIndices())
|
||||||
);
|
);
|
||||||
const globalIndex& globalIndices = globalPointNumberingPtr_();
|
const globalIndex& globalIndices = globalIndicesPtr();
|
||||||
|
|
||||||
// Create master to slave addressing. Empty for slave points.
|
// Create master to slave addressing. Empty for slave points.
|
||||||
globalPointSlavesPtr_.reset
|
globalPointSlavesPtr.reset
|
||||||
(
|
(
|
||||||
new labelListList(coupledPatch().nPoints())
|
new labelListList(coupledPatch().nPoints())
|
||||||
);
|
);
|
||||||
labelListList& globalPointSlaves = globalPointSlavesPtr_();
|
labelListList& globalPointSlaves = globalPointSlavesPtr();
|
||||||
|
|
||||||
|
|
||||||
|
const Map<label>& meshToProcPoint = globalData.meshToProcPoint();
|
||||||
|
|
||||||
forAllConstIter(Map<label>, meshToProcPoint, iter)
|
forAllConstIter(Map<label>, meshToProcPoint, iter)
|
||||||
{
|
{
|
||||||
@ -465,7 +462,7 @@ void Foam::globalMeshData::calcGlobalPointSlaves() const
|
|||||||
// Changes globalPointSlaves to be indices into compact data
|
// Changes globalPointSlaves to be indices into compact data
|
||||||
|
|
||||||
List<Map<label> > compactMap(Pstream::nProcs());
|
List<Map<label> > compactMap(Pstream::nProcs());
|
||||||
globalPointSlavesMapPtr_.reset
|
globalPointSlavesMapPtr.reset
|
||||||
(
|
(
|
||||||
new mapDistribute
|
new mapDistribute
|
||||||
(
|
(
|
||||||
@ -477,41 +474,50 @@ void Foam::globalMeshData::calcGlobalPointSlaves() const
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "globalMeshData::calcGlobalPointSlaves() :"
|
Pout<< "globalMeshData::calcGlobalPointSlaves(..) :"
|
||||||
<< " coupled points:" << coupledPatch().nPoints()
|
<< " coupled points:" << coupledPatch().nPoints()
|
||||||
<< " additional remote points:"
|
<< " additional remote points:"
|
||||||
<< globalPointSlavesMapPtr_().constructSize()
|
<< globalPointSlavesMapPtr().constructSize()
|
||||||
- coupledPatch().nPoints()
|
- coupledPatch().nPoints()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
void Foam::globalMeshData::calcGlobalPointSlaves() const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
Pout<< "globalMeshData::calcGlobalPointSlaves() :"
|
||||||
<< " calculating coupled master to slave edge addressing."
|
<< " calculating coupled master to collocated"
|
||||||
|
<< " slave point addressing."
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelListList& globalPointSlaves = this->globalPointSlaves();
|
// Calculate collocated connected points for master points.
|
||||||
const mapDistribute& globalPointSlavesMap = this->globalPointSlavesMap();
|
globalPoints collocatedGlobalData(mesh_, coupledPatch(), true, false);
|
||||||
|
|
||||||
// - Send across connected edges (in global edge addressing)
|
calcGlobalPointSlaves
|
||||||
// - Check on receiving side whether edge has same slave edge
|
|
||||||
// on both endpoints.
|
|
||||||
|
|
||||||
// Create global numbering for coupled edges
|
|
||||||
globalEdgeNumberingPtr_.reset
|
|
||||||
(
|
(
|
||||||
new globalIndex(coupledPatch().nEdges())
|
collocatedGlobalData,
|
||||||
|
globalPointNumberingPtr_,
|
||||||
|
globalPointSlavesPtr_,
|
||||||
|
globalPointSlavesMapPtr_
|
||||||
);
|
);
|
||||||
const globalIndex& globalIndices = globalEdgeNumberingPtr_();
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::globalMeshData::calcGlobalEdgeSlaves
|
||||||
|
(
|
||||||
|
const labelListList& pointSlaves,
|
||||||
|
const mapDistribute& pointSlavesMap,
|
||||||
|
const globalIndex& globalEdgeIndices,
|
||||||
|
autoPtr<labelListList>& globalEdgeSlavesPtr,
|
||||||
|
autoPtr<mapDistribute>& globalEdgeSlavesMapPtr
|
||||||
|
) const
|
||||||
|
{
|
||||||
// Coupled point to global coupled edges.
|
// Coupled point to global coupled edges.
|
||||||
labelListList globalPointEdges(globalPointSlavesMap.constructSize());
|
labelListList globalPointEdges(pointSlavesMap.constructSize());
|
||||||
|
|
||||||
// Create local version
|
// Create local version
|
||||||
const labelListList& pointEdges = coupledPatch().pointEdges();
|
const labelListList& pointEdges = coupledPatch().pointEdges();
|
||||||
@ -522,12 +528,12 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
|||||||
globalPEdges.setSize(pEdges.size());
|
globalPEdges.setSize(pEdges.size());
|
||||||
forAll(pEdges, i)
|
forAll(pEdges, i)
|
||||||
{
|
{
|
||||||
globalPEdges[i] = globalIndices.toGlobal(pEdges[i]);
|
globalPEdges[i] = globalEdgeIndices.toGlobal(pEdges[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pull slave data to master
|
// Pull slave data to master
|
||||||
globalPointSlavesMap.distribute(globalPointEdges);
|
pointSlavesMap.distribute(globalPointEdges);
|
||||||
|
|
||||||
// Now check on master if any of my edges are also on slave.
|
// Now check on master if any of my edges are also on slave.
|
||||||
// This assumes that if slaves have a coupled edge it is also on
|
// This assumes that if slaves have a coupled edge it is also on
|
||||||
@ -538,14 +544,14 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
|||||||
const edgeList& edges = coupledPatch().edges();
|
const edgeList& edges = coupledPatch().edges();
|
||||||
|
|
||||||
// Create master to slave addressing. Empty for slave edges.
|
// Create master to slave addressing. Empty for slave edges.
|
||||||
globalEdgeSlavesPtr_.reset(new labelListList(edges.size()));
|
globalEdgeSlavesPtr.reset(new labelListList(edges.size()));
|
||||||
labelListList& globalEdgeSlaves = globalEdgeSlavesPtr_();
|
labelListList& globalEdgeSlaves = globalEdgeSlavesPtr();
|
||||||
|
|
||||||
forAll(edges, edgeI)
|
forAll(edges, edgeI)
|
||||||
{
|
{
|
||||||
const edge& e = edges[edgeI];
|
const edge& e = edges[edgeI];
|
||||||
const labelList& slaves0 = globalPointSlaves[e[0]];
|
const labelList& slaves0 = pointSlaves[e[0]];
|
||||||
const labelList& slaves1 = globalPointSlaves[e[1]];
|
const labelList& slaves1 = pointSlaves[e[1]];
|
||||||
|
|
||||||
// Check for edges that are in both slaves0 and slaves1.
|
// Check for edges that are in both slaves0 and slaves1.
|
||||||
pointEdgeSet.clear();
|
pointEdgeSet.clear();
|
||||||
@ -576,11 +582,11 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
|||||||
|
|
||||||
// Construct map
|
// Construct map
|
||||||
List<Map<label> > compactMap(Pstream::nProcs());
|
List<Map<label> > compactMap(Pstream::nProcs());
|
||||||
globalEdgeSlavesMapPtr_.reset
|
globalEdgeSlavesMapPtr.reset
|
||||||
(
|
(
|
||||||
new mapDistribute
|
new mapDistribute
|
||||||
(
|
(
|
||||||
globalIndices,
|
globalEdgeIndices,
|
||||||
globalEdgeSlaves,
|
globalEdgeSlaves,
|
||||||
compactMap
|
compactMap
|
||||||
)
|
)
|
||||||
@ -591,12 +597,39 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
|||||||
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
||||||
<< " coupled edge:" << edges.size()
|
<< " coupled edge:" << edges.size()
|
||||||
<< " additional remote edges:"
|
<< " additional remote edges:"
|
||||||
<< globalEdgeSlavesMapPtr_().constructSize() - edges.size()
|
<< globalEdgeSlavesMapPtr().constructSize() - edges.size()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
||||||
|
<< " calculating coupled master to collocated slave"
|
||||||
|
<< " edge addressing." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - Send across connected edges (in global edge addressing)
|
||||||
|
// - Check on receiving side whether edge has same slave edge
|
||||||
|
// on both endpoints.
|
||||||
|
|
||||||
|
// Create global numbering for coupled edges
|
||||||
|
const globalIndex& globalIndices = globalEdgeNumbering();
|
||||||
|
|
||||||
|
calcGlobalEdgeSlaves
|
||||||
|
(
|
||||||
|
globalPointSlaves(),
|
||||||
|
globalPointSlavesMap(),
|
||||||
|
globalIndices,
|
||||||
|
globalEdgeSlavesPtr_,
|
||||||
|
globalEdgeSlavesMapPtr_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Calculate uncoupled boundary faces (without calculating
|
// Calculate uncoupled boundary faces (without calculating
|
||||||
// primitiveMesh::pointFaces())
|
// primitiveMesh::pointFaces())
|
||||||
void Foam::globalMeshData::calcPointBoundaryFaces
|
void Foam::globalMeshData::calcPointBoundaryFaces
|
||||||
@ -961,6 +994,55 @@ void Foam::globalMeshData::calcGlobalPointBoundaryCells() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::globalMeshData::calcGlobalPointAllSlaves() const
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "globalMeshData::calcGlobalPointAllSlaves() :"
|
||||||
|
<< " calculating coupled master to slave point addressing."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate collocated&non-collocated connected points for master points.
|
||||||
|
globalPoints allGlobalData(mesh_, coupledPatch(), true, true);
|
||||||
|
|
||||||
|
calcGlobalPointSlaves
|
||||||
|
(
|
||||||
|
allGlobalData,
|
||||||
|
globalPointAllNumberingPtr_,
|
||||||
|
globalPointAllSlavesPtr_,
|
||||||
|
globalPointAllSlavesMapPtr_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::globalMeshData::calcGlobalEdgeAllSlaves() const
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "globalMeshData::calcGlobalEdgeAllSlaves() :"
|
||||||
|
<< " calculating coupled master to slave edge addressing."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - Send across connected edges (in global edge addressing)
|
||||||
|
// - Check on receiving side whether edge has same slave edge
|
||||||
|
// on both endpoints.
|
||||||
|
|
||||||
|
// Create global numbering for coupled edges
|
||||||
|
const globalIndex& globalIndices = globalEdgeNumbering();
|
||||||
|
|
||||||
|
calcGlobalEdgeSlaves
|
||||||
|
(
|
||||||
|
globalPointAllSlaves(),
|
||||||
|
globalPointAllSlavesMap(),
|
||||||
|
globalIndices,
|
||||||
|
globalEdgeAllSlavesPtr_,
|
||||||
|
globalEdgeAllSlavesMapPtr_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Construct from polyMesh
|
// Construct from polyMesh
|
||||||
@ -1057,6 +1139,17 @@ void Foam::globalMeshData::clearOut()
|
|||||||
globalBoundaryCellNumberingPtr_.clear();
|
globalBoundaryCellNumberingPtr_.clear();
|
||||||
globalPointBoundaryCellsPtr_.clear();
|
globalPointBoundaryCellsPtr_.clear();
|
||||||
globalPointBoundaryCellsMapPtr_.clear();
|
globalPointBoundaryCellsMapPtr_.clear();
|
||||||
|
|
||||||
|
//- Non-collocated
|
||||||
|
|
||||||
|
// Point
|
||||||
|
globalPointAllNumberingPtr_.clear();
|
||||||
|
globalPointAllSlavesPtr_.clear();
|
||||||
|
globalPointAllSlavesMapPtr_.clear();
|
||||||
|
// Edge
|
||||||
|
globalEdgeAllSlavesPtr_.clear();
|
||||||
|
globalEdgeAllSlavesMapPtr_.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1212,7 +1305,7 @@ Foam::pointField Foam::globalMeshData::geometricSharedPoints() const
|
|||||||
labelList pMap;
|
labelList pMap;
|
||||||
pointField mergedPoints;
|
pointField mergedPoints;
|
||||||
|
|
||||||
mergePoints
|
Foam::mergePoints
|
||||||
(
|
(
|
||||||
sharedPoints, // coordinates to merge
|
sharedPoints, // coordinates to merge
|
||||||
tolDim, // tolerance
|
tolDim, // tolerance
|
||||||
@ -1350,7 +1443,10 @@ const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
|
|||||||
{
|
{
|
||||||
if (!globalEdgeNumberingPtr_.valid())
|
if (!globalEdgeNumberingPtr_.valid())
|
||||||
{
|
{
|
||||||
calcGlobalEdgeSlaves();
|
globalEdgeNumberingPtr_.reset
|
||||||
|
(
|
||||||
|
new globalIndex(coupledPatch().nEdges())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return globalEdgeNumberingPtr_();
|
return globalEdgeNumberingPtr_();
|
||||||
}
|
}
|
||||||
@ -1452,6 +1548,293 @@ const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Non-collocated coupled point/edge addressing
|
||||||
|
|
||||||
|
const Foam::globalIndex& Foam::globalMeshData::globalPointAllNumbering() const
|
||||||
|
{
|
||||||
|
if (!globalPointAllNumberingPtr_.valid())
|
||||||
|
{
|
||||||
|
calcGlobalPointAllSlaves();
|
||||||
|
}
|
||||||
|
return globalPointAllNumberingPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::labelListList& Foam::globalMeshData::globalPointAllSlaves() const
|
||||||
|
{
|
||||||
|
if (!globalPointAllSlavesPtr_.valid())
|
||||||
|
{
|
||||||
|
calcGlobalPointAllSlaves();
|
||||||
|
}
|
||||||
|
return globalPointAllSlavesPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::mapDistribute& Foam::globalMeshData::globalPointAllSlavesMap() const
|
||||||
|
{
|
||||||
|
if (!globalPointAllSlavesMapPtr_.valid())
|
||||||
|
{
|
||||||
|
calcGlobalPointAllSlaves();
|
||||||
|
}
|
||||||
|
return globalPointAllSlavesMapPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::labelListList& Foam::globalMeshData::globalEdgeAllSlaves() const
|
||||||
|
{
|
||||||
|
if (!globalEdgeAllSlavesPtr_.valid())
|
||||||
|
{
|
||||||
|
calcGlobalEdgeAllSlaves();
|
||||||
|
}
|
||||||
|
return globalEdgeAllSlavesPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::mapDistribute& Foam::globalMeshData::globalEdgeAllSlavesMap() const
|
||||||
|
{
|
||||||
|
if (!globalEdgeAllSlavesMapPtr_.valid())
|
||||||
|
{
|
||||||
|
calcGlobalEdgeAllSlaves();
|
||||||
|
}
|
||||||
|
return globalEdgeAllSlavesMapPtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||||
|
(
|
||||||
|
labelList& pointToGlobal,
|
||||||
|
labelList& uniquePoints
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const indirectPrimitivePatch& cpp = coupledPatch();
|
||||||
|
const labelListList& pointSlaves = globalPointSlaves();
|
||||||
|
const mapDistribute& pointSlavesMap = globalPointSlavesMap();
|
||||||
|
|
||||||
|
|
||||||
|
// 1. Count number of masters on my processor.
|
||||||
|
label nCoupledMaster = 0;
|
||||||
|
PackedBoolList isMaster(mesh_.nPoints(), 1);
|
||||||
|
forAll(pointSlaves, pointI)
|
||||||
|
{
|
||||||
|
const labelList& slavePoints = pointSlaves[pointI];
|
||||||
|
|
||||||
|
if (slavePoints.size() > 0)
|
||||||
|
{
|
||||||
|
nCoupledMaster++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isMaster[cpp.meshPoints()[pointI]] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label myUniquePoints = mesh_.nPoints() - cpp.nPoints() + nCoupledMaster;
|
||||||
|
|
||||||
|
//Pout<< "Points :" << nl
|
||||||
|
// << " mesh : " << mesh_.nPoints() << nl
|
||||||
|
// << " of which coupled : " << cpp.nPoints() << nl
|
||||||
|
// << " of which master : " << nCoupledMaster << nl
|
||||||
|
// << endl;
|
||||||
|
|
||||||
|
|
||||||
|
// 2. Create global indexing for unique points.
|
||||||
|
autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints));
|
||||||
|
|
||||||
|
|
||||||
|
// 3. Assign global point numbers. Keep slaves unset.
|
||||||
|
pointToGlobal.setSize(mesh_.nPoints());
|
||||||
|
pointToGlobal = -1;
|
||||||
|
uniquePoints.setSize(myUniquePoints);
|
||||||
|
label nMaster = 0;
|
||||||
|
|
||||||
|
forAll(isMaster, meshPointI)
|
||||||
|
{
|
||||||
|
if (isMaster[meshPointI])
|
||||||
|
{
|
||||||
|
pointToGlobal[meshPointI] = globalPointsPtr().toGlobal(nMaster);
|
||||||
|
uniquePoints[nMaster] = meshPointI;
|
||||||
|
nMaster++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 4. Push global index for coupled points to slaves.
|
||||||
|
{
|
||||||
|
labelList masterToGlobal(pointSlavesMap.constructSize(), -1);
|
||||||
|
|
||||||
|
forAll(pointSlaves, pointI)
|
||||||
|
{
|
||||||
|
const labelList& slaves = pointSlaves[pointI];
|
||||||
|
|
||||||
|
if (slaves.size() > 0)
|
||||||
|
{
|
||||||
|
// Duplicate master globalpoint into slave slots
|
||||||
|
label meshPointI = cpp.meshPoints()[pointI];
|
||||||
|
masterToGlobal[pointI] = pointToGlobal[meshPointI];
|
||||||
|
forAll(slaves, i)
|
||||||
|
{
|
||||||
|
masterToGlobal[slaves[i]] = masterToGlobal[pointI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send back
|
||||||
|
pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal);
|
||||||
|
|
||||||
|
// On slave copy master index into overal map.
|
||||||
|
forAll(pointSlaves, pointI)
|
||||||
|
{
|
||||||
|
const labelList& slaves = pointSlaves[pointI];
|
||||||
|
|
||||||
|
if (slaves.size() == 0)
|
||||||
|
{
|
||||||
|
label meshPointI = cpp.meshPoints()[pointI];
|
||||||
|
pointToGlobal[meshPointI] = masterToGlobal[pointI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return globalPointsPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||||
|
(
|
||||||
|
const labelList& meshPoints,
|
||||||
|
const Map<label>& meshPointMap,
|
||||||
|
labelList& pointToGlobal,
|
||||||
|
labelList& uniquePoints
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const indirectPrimitivePatch& cpp = coupledPatch();
|
||||||
|
const labelListList& pointSlaves = globalPointSlaves();
|
||||||
|
const mapDistribute& pointSlavesMap = globalPointSlavesMap();
|
||||||
|
|
||||||
|
|
||||||
|
// 1. Count number of masters on my processor.
|
||||||
|
label nCoupledMaster = 0;
|
||||||
|
label nCoupledSlave = 0;
|
||||||
|
PackedBoolList isMaster(meshPoints.size(), 1);
|
||||||
|
|
||||||
|
forAll(meshPoints, localPointI)
|
||||||
|
{
|
||||||
|
label meshPointI = meshPoints[localPointI];
|
||||||
|
|
||||||
|
Map<label>::const_iterator iter = cpp.meshPointMap().find(meshPointI);
|
||||||
|
|
||||||
|
if (iter != cpp.meshPointMap().end())
|
||||||
|
{
|
||||||
|
// My localPointI is a coupled point.
|
||||||
|
|
||||||
|
label coupledPointI = iter();
|
||||||
|
|
||||||
|
if (pointSlaves[coupledPointI].size() > 0)
|
||||||
|
{
|
||||||
|
nCoupledMaster++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isMaster[localPointI] = 0;
|
||||||
|
nCoupledSlave++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label myUniquePoints = meshPoints.size() - nCoupledSlave;
|
||||||
|
|
||||||
|
Pout<< "Points :" << nl
|
||||||
|
<< " patch : " << meshPoints.size() << nl
|
||||||
|
<< " of which coupled : " << nCoupledMaster+nCoupledSlave << nl
|
||||||
|
<< " of which master : " << nCoupledMaster << nl
|
||||||
|
<< " of which slave : " << nCoupledSlave << nl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
|
||||||
|
// 2. Create global indexing for unique points.
|
||||||
|
autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints));
|
||||||
|
|
||||||
|
|
||||||
|
// 3. Assign global point numbers. Keep slaves unset.
|
||||||
|
pointToGlobal.setSize(meshPoints.size());
|
||||||
|
pointToGlobal = -1;
|
||||||
|
uniquePoints.setSize(myUniquePoints);
|
||||||
|
label nMaster = 0;
|
||||||
|
|
||||||
|
forAll(isMaster, localPointI)
|
||||||
|
{
|
||||||
|
if (isMaster[localPointI])
|
||||||
|
{
|
||||||
|
pointToGlobal[localPointI] = globalPointsPtr().toGlobal(nMaster);
|
||||||
|
uniquePoints[nMaster] = localPointI;
|
||||||
|
nMaster++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 4. Push global index for coupled points to slaves.
|
||||||
|
{
|
||||||
|
labelList masterToGlobal(pointSlavesMap.constructSize(), -1);
|
||||||
|
|
||||||
|
forAll(meshPoints, localPointI)
|
||||||
|
{
|
||||||
|
label meshPointI = meshPoints[localPointI];
|
||||||
|
|
||||||
|
Map<label>::const_iterator iter = cpp.meshPointMap().find
|
||||||
|
(
|
||||||
|
meshPointI
|
||||||
|
);
|
||||||
|
|
||||||
|
if (iter != cpp.meshPointMap().end())
|
||||||
|
{
|
||||||
|
// My localPointI is a coupled point.
|
||||||
|
label coupledPointI = iter();
|
||||||
|
|
||||||
|
const labelList& slaves = pointSlaves[coupledPointI];
|
||||||
|
|
||||||
|
if (slaves.size() > 0)
|
||||||
|
{
|
||||||
|
// Duplicate master globalpoint into slave slots
|
||||||
|
masterToGlobal[coupledPointI] = pointToGlobal[localPointI];
|
||||||
|
forAll(slaves, i)
|
||||||
|
{
|
||||||
|
masterToGlobal[slaves[i]] = pointToGlobal[localPointI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send back
|
||||||
|
pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal);
|
||||||
|
|
||||||
|
// On slave copy master index into overal map.
|
||||||
|
forAll(meshPoints, localPointI)
|
||||||
|
{
|
||||||
|
label meshPointI = meshPoints[localPointI];
|
||||||
|
|
||||||
|
Map<label>::const_iterator iter = cpp.meshPointMap().find
|
||||||
|
(
|
||||||
|
meshPointI
|
||||||
|
);
|
||||||
|
|
||||||
|
if (iter != cpp.meshPointMap().end())
|
||||||
|
{
|
||||||
|
// My localPointI is a coupled point.
|
||||||
|
label coupledPointI = iter();
|
||||||
|
const labelList& slaves = pointSlaves[coupledPointI];
|
||||||
|
|
||||||
|
if (slaves.size() == 0)
|
||||||
|
{
|
||||||
|
pointToGlobal[localPointI] = masterToGlobal[coupledPointI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return globalPointsPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::globalMeshData::movePoints(const pointField& newPoints)
|
void Foam::globalMeshData::movePoints(const pointField& newPoints)
|
||||||
{
|
{
|
||||||
// Topology does not change and we don't store any geometry so nothing
|
// Topology does not change and we don't store any geometry so nothing
|
||||||
@ -1482,8 +1865,9 @@ void Foam::globalMeshData::updateMesh()
|
|||||||
|
|
||||||
// Option 1. Topological
|
// Option 1. Topological
|
||||||
{
|
{
|
||||||
// Calculate all shared points. This does all the hard work.
|
// Calculate all shared points (excluded points that are only
|
||||||
globalPoints parallelPoints(mesh_, false);
|
// on two coupled patches). This does all the hard work.
|
||||||
|
globalPoints parallelPoints(mesh_, false, true);
|
||||||
|
|
||||||
// Copy data out.
|
// Copy data out.
|
||||||
nGlobalPoints_ = parallelPoints.nGlobalPoints();
|
nGlobalPoints_ = parallelPoints.nGlobalPoints();
|
||||||
@ -1505,6 +1889,16 @@ void Foam::globalMeshData::updateMesh()
|
|||||||
// sharedEdgeAddr_ = parallelPoints.sharedEdgeAddr();
|
// sharedEdgeAddr_ = parallelPoints.sharedEdgeAddr();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "globalMeshData : nGlobalPoints_:" << nGlobalPoints_ << nl
|
||||||
|
<< "globalMeshData : sharedPointLabels_:"
|
||||||
|
<< sharedPointLabels_.size() << nl
|
||||||
|
<< "globalMeshData : sharedPointAddr_:"
|
||||||
|
<< sharedPointAddr_.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Total number of faces. Start off from all faces. Remove coincident
|
// Total number of faces. Start off from all faces. Remove coincident
|
||||||
// processor faces (on highest numbered processor) before summing.
|
// processor faces (on highest numbered processor) before summing.
|
||||||
nTotalFaces_ = mesh_.nFaces();
|
nTotalFaces_ = mesh_.nFaces();
|
||||||
|
|||||||
@ -31,7 +31,7 @@ Description
|
|||||||
|
|
||||||
Requires:
|
Requires:
|
||||||
- all processor patches to have correct ordering.
|
- all processor patches to have correct ordering.
|
||||||
- all processorPatches to have their transforms set ('makeTransforms')
|
- all processorPatches to have their transforms set.
|
||||||
|
|
||||||
The shared point addressing is quite interesting. It gives on each processor
|
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.
|
the vertices that cannot be set using a normal swap on processor patches.
|
||||||
@ -67,14 +67,12 @@ Description
|
|||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
globalMeshData.C
|
globalMeshData.C
|
||||||
globalMeshDataMorph.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef globalMeshData_H
|
#ifndef globalMeshData_H
|
||||||
#define globalMeshData_H
|
#define globalMeshData_H
|
||||||
|
|
||||||
//#include "polyMesh.H"
|
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
#include "processorTopology.H"
|
#include "processorTopology.H"
|
||||||
#include "labelPair.H"
|
#include "labelPair.H"
|
||||||
@ -95,6 +93,7 @@ class globalIndex;
|
|||||||
class polyMesh;
|
class polyMesh;
|
||||||
class mapDistribute;
|
class mapDistribute;
|
||||||
template<class T> class EdgeMap;
|
template<class T> class EdgeMap;
|
||||||
|
class globalPoints;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class globalMeshData Declaration
|
Class globalMeshData Declaration
|
||||||
@ -201,31 +200,36 @@ class globalMeshData
|
|||||||
|
|
||||||
|
|
||||||
// Coupled point addressing
|
// Coupled point addressing
|
||||||
// This is addressing from coupled point to coupled points,faces,cells
|
// 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
|
// This is a full schedule so includes points only used by two
|
||||||
// coupled patches.
|
// coupled patches.
|
||||||
|
|
||||||
mutable autoPtr<indirectPrimitivePatch> coupledPatchPtr_;
|
mutable autoPtr<indirectPrimitivePatch> coupledPatchPtr_;
|
||||||
|
|
||||||
// Coupled point to coupled points
|
// Collocated
|
||||||
|
|
||||||
|
// Coupled point to collocated coupled points
|
||||||
|
|
||||||
mutable autoPtr<globalIndex> globalPointNumberingPtr_;
|
mutable autoPtr<globalIndex> globalPointNumberingPtr_;
|
||||||
mutable autoPtr<labelListList> globalPointSlavesPtr_;
|
mutable autoPtr<labelListList> globalPointSlavesPtr_;
|
||||||
mutable autoPtr<mapDistribute> globalPointSlavesMapPtr_;
|
mutable autoPtr<mapDistribute> globalPointSlavesMapPtr_;
|
||||||
|
|
||||||
// Coupled edge to coupled edges
|
// Coupled edge to collocated coupled edges
|
||||||
|
|
||||||
mutable autoPtr<globalIndex> globalEdgeNumberingPtr_;
|
mutable autoPtr<globalIndex> globalEdgeNumberingPtr_;
|
||||||
mutable autoPtr<labelListList> globalEdgeSlavesPtr_;
|
mutable autoPtr<labelListList> globalEdgeSlavesPtr_;
|
||||||
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
|
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
|
||||||
|
|
||||||
// Coupled point to boundary faces
|
// Coupled point to collocated boundary faces
|
||||||
|
|
||||||
mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
|
mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
|
||||||
mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
|
mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
|
||||||
mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
||||||
|
|
||||||
// Coupled point to boundary cells
|
// Coupled point to collocated boundary cells
|
||||||
|
|
||||||
mutable autoPtr<labelList> boundaryCellsPtr_;
|
mutable autoPtr<labelList> boundaryCellsPtr_;
|
||||||
mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
||||||
@ -233,6 +237,21 @@ class globalMeshData
|
|||||||
mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
|
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_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Set up processor patch addressing
|
//- Set up processor patch addressing
|
||||||
@ -256,9 +275,28 @@ class globalMeshData
|
|||||||
const vectorField& separationDist
|
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;
|
void calcGlobalPointSlaves() const;
|
||||||
|
|
||||||
|
//- Calculate global edge addressing.
|
||||||
|
void calcGlobalEdgeSlaves
|
||||||
|
(
|
||||||
|
const labelListList&,
|
||||||
|
const mapDistribute&,
|
||||||
|
const globalIndex&,
|
||||||
|
autoPtr<labelListList>&,
|
||||||
|
autoPtr<mapDistribute>&
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Calculate global edge addressing.
|
//- Calculate global edge addressing.
|
||||||
void calcGlobalEdgeSlaves() const;
|
void calcGlobalEdgeSlaves() const;
|
||||||
|
|
||||||
@ -272,6 +310,15 @@ class globalMeshData
|
|||||||
void calcGlobalPointBoundaryCells() const;
|
void calcGlobalPointBoundaryCells() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Non-collocated
|
||||||
|
|
||||||
|
//- Calculate global point addressing.
|
||||||
|
void calcGlobalPointAllSlaves() const;
|
||||||
|
|
||||||
|
//- Calculate global edge addressing.
|
||||||
|
void calcGlobalEdgeAllSlaves() const;
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
globalMeshData(const globalMeshData&);
|
globalMeshData(const globalMeshData&);
|
||||||
|
|
||||||
@ -449,8 +496,8 @@ public:
|
|||||||
//- Return patch of all coupled faces
|
//- Return patch of all coupled faces
|
||||||
const indirectPrimitivePatch& coupledPatch() const;
|
const indirectPrimitivePatch& coupledPatch() const;
|
||||||
|
|
||||||
// Coupled point to coupled points. Coupled points are points on
|
// Coupled point to collocated coupled points. Coupled points are
|
||||||
// any coupled patch.
|
// points on any coupled patch.
|
||||||
|
|
||||||
//- Numbering of coupled points is according to coupledPatch.
|
//- Numbering of coupled points is according to coupledPatch.
|
||||||
const globalIndex& globalPointNumbering() const;
|
const globalIndex& globalPointNumbering() const;
|
||||||
@ -484,6 +531,45 @@ public:
|
|||||||
const mapDistribute& globalPointBoundaryCellsMap() 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;
|
||||||
|
|
||||||
|
// Coupled edge to all coupled edges (same numbering as
|
||||||
|
// collocated)
|
||||||
|
|
||||||
|
const labelListList& globalEdgeAllSlaves() const;
|
||||||
|
const mapDistribute& globalEdgeAllSlavesMap() const;
|
||||||
|
|
||||||
|
// Other
|
||||||
|
|
||||||
|
//- Helper for merging mesh point data. Determines
|
||||||
|
// - my unique indices
|
||||||
|
// - global numbering over all unique indices
|
||||||
|
// - the global number for all local points (so this will
|
||||||
|
// be local for my unique points)
|
||||||
|
autoPtr<globalIndex> mergePoints
|
||||||
|
(
|
||||||
|
labelList& pointToGlobal,
|
||||||
|
labelList& uniquePoints
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Helper for merging patch point data. Takes maps from
|
||||||
|
// local points to/from mesh
|
||||||
|
autoPtr<globalIndex> mergePoints
|
||||||
|
(
|
||||||
|
const labelList& meshPoints,
|
||||||
|
const Map<label>& meshPointMap,
|
||||||
|
labelList& pointToGlobal,
|
||||||
|
labelList& uniquePoints
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Update for moving points.
|
//- Update for moving points.
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -67,8 +67,8 @@ Description
|
|||||||
At this point one will have complete point-point connectivity for all
|
At this point one will have complete point-point connectivity for all
|
||||||
points on processor patches. Now
|
points on processor patches. Now
|
||||||
|
|
||||||
- remove point equivalences of size 2. These are just normal points
|
- (optional)remove point equivalences of size 2. These are
|
||||||
shared between two neighbouring procPatches.
|
just normal points shared between two neighbouring procPatches.
|
||||||
- collect on each processor points for which it is the master
|
- collect on each processor points for which it is the master
|
||||||
- request number of sharedPointLabels from the Pstream::master.
|
- request number of sharedPointLabels from the Pstream::master.
|
||||||
|
|
||||||
@ -98,10 +98,10 @@ SourceFiles
|
|||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
#include "className.H"
|
|
||||||
#include "edgeList.H"
|
#include "edgeList.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
|
#include "PackedBoolList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -112,6 +112,8 @@ namespace Foam
|
|||||||
class polyMesh;
|
class polyMesh;
|
||||||
class polyBoundaryMesh;
|
class polyBoundaryMesh;
|
||||||
class cyclicPolyPatch;
|
class cyclicPolyPatch;
|
||||||
|
class polyPatch;
|
||||||
|
class coupledPolyPatch;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class globalPoints Declaration
|
Class globalPoints Declaration
|
||||||
@ -119,7 +121,15 @@ class cyclicPolyPatch;
|
|||||||
|
|
||||||
class globalPoints
|
class globalPoints
|
||||||
{
|
{
|
||||||
// Private classes
|
// Static data members
|
||||||
|
|
||||||
|
//- Offset to add to points (in globalIndices) originating from
|
||||||
|
// collocated coupled points.
|
||||||
|
static const label fromCollocated;
|
||||||
|
|
||||||
|
//- Distance to check whether points/faces are collocated.
|
||||||
|
static const scalar mergeDist;
|
||||||
|
|
||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -152,13 +162,53 @@ class globalPoints
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Is identity transform?
|
||||||
|
static bool noTransform(const tensor&, const scalar mergeDist);
|
||||||
|
|
||||||
|
//- Return per face collocated status
|
||||||
|
static PackedBoolList collocatedFaces
|
||||||
|
(
|
||||||
|
const coupledPolyPatch&,
|
||||||
|
const scalar mergeDist
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Return per point collocated status
|
||||||
|
static PackedBoolList collocatedPoints
|
||||||
|
(
|
||||||
|
const coupledPolyPatch&,
|
||||||
|
const scalar mergeDist
|
||||||
|
);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//- Count all points on processorPatches. Is all points for which
|
//- Count all points on processorPatches. Is all points for which
|
||||||
// information is collected.
|
// information is collected.
|
||||||
static label countPatchPoints(const polyBoundaryMesh&);
|
static label countPatchPoints(const polyBoundaryMesh&);
|
||||||
|
|
||||||
////- Get all faces on coupled patches
|
|
||||||
//static labelListl coupledFaces(const polyBoundaryMesh&);
|
|
||||||
|
|
||||||
//- Add information about patchPointI in relative indices to send
|
//- Add information about patchPointI in relative indices to send
|
||||||
// buffers (patchFaces, indexInFace etc.)
|
// buffers (patchFaces, indexInFace etc.)
|
||||||
static void addToSend
|
static void addToSend
|
||||||
@ -197,9 +247,17 @@ class globalPoints
|
|||||||
bool storeInfo
|
bool storeInfo
|
||||||
(
|
(
|
||||||
const labelList& nbrInfo,
|
const labelList& nbrInfo,
|
||||||
const label localPointI
|
const label localPointI,
|
||||||
|
const bool isCollocated
|
||||||
);
|
);
|
||||||
|
|
||||||
|
void printProcPoints
|
||||||
|
(
|
||||||
|
const labelList& patchToMeshPoint,
|
||||||
|
const labelList& pointInfo,
|
||||||
|
Ostream& os
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Initialize procPoints_ to my patch points. allPoints = true:
|
//- Initialize procPoints_ to my patch points. allPoints = true:
|
||||||
// seed with all patch points, = false: only boundaryPoints().
|
// seed with all patch points, = false: only boundaryPoints().
|
||||||
void initOwnPoints
|
void initOwnPoints
|
||||||
@ -212,6 +270,7 @@ class globalPoints
|
|||||||
//- Send subset of procPoints to neighbours
|
//- Send subset of procPoints to neighbours
|
||||||
void sendPatchPoints
|
void sendPatchPoints
|
||||||
(
|
(
|
||||||
|
const bool mergeSeparated,
|
||||||
const Map<label>&,
|
const Map<label>&,
|
||||||
PstreamBuffers&,
|
PstreamBuffers&,
|
||||||
const labelHashSet&
|
const labelHashSet&
|
||||||
@ -220,6 +279,7 @@ class globalPoints
|
|||||||
//- Receive neighbour points and merge into my procPoints.
|
//- Receive neighbour points and merge into my procPoints.
|
||||||
void receivePatchPoints
|
void receivePatchPoints
|
||||||
(
|
(
|
||||||
|
const bool mergeSeparated,
|
||||||
const Map<label>&,
|
const Map<label>&,
|
||||||
PstreamBuffers&,
|
PstreamBuffers&,
|
||||||
labelHashSet&
|
labelHashSet&
|
||||||
@ -230,20 +290,31 @@ class globalPoints
|
|||||||
void remove(const labelList& patchToMeshPoint, const Map<label>&);
|
void remove(const labelList& patchToMeshPoint, const Map<label>&);
|
||||||
|
|
||||||
//- Compact out unused elements of procPoints.
|
//- Compact out unused elements of procPoints.
|
||||||
void compact();
|
void compact(const labelList& patchToMeshPoint);
|
||||||
|
|
||||||
//- Get indices of point for which I am master (lowest numbered proc)
|
//- Get indices of point for which I am master (lowest numbered proc)
|
||||||
labelList getMasterPoints(const labelList& patchToMeshPoint) const;
|
labelList getMasterPoints(const labelList& patchToMeshPoint) const;
|
||||||
|
|
||||||
|
|
||||||
//- Send subset of shared points to neighbours
|
//- Send subset of shared points to neighbours
|
||||||
void sendSharedPoints(PstreamBuffers&, const labelList&) const;
|
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.
|
//- Receive shared points and update subset.
|
||||||
void receiveSharedPoints
|
void receiveSharedPoints
|
||||||
(
|
(
|
||||||
const Map<label>&,
|
const bool mergeSeparated,
|
||||||
|
const Map<label>& meshToPatchPoint,
|
||||||
|
const Map<label>& meshToShared,
|
||||||
PstreamBuffers&,
|
PstreamBuffers&,
|
||||||
labelList&
|
DynamicList<label>&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Should move into cyclicPolyPatch ordering problem
|
//- Should move into cyclicPolyPatch ordering problem
|
||||||
@ -255,7 +326,8 @@ class globalPoints
|
|||||||
(
|
(
|
||||||
const Map<label>&,
|
const Map<label>&,
|
||||||
const labelList&,
|
const labelList&,
|
||||||
const bool keepAllPoints
|
const bool keepAllPoints,
|
||||||
|
const bool mergeSeparated
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
@ -276,7 +348,15 @@ public:
|
|||||||
//- Construct from mesh.
|
//- Construct from mesh.
|
||||||
// keepAllPoints = false : filter out points that are on two
|
// keepAllPoints = false : filter out points that are on two
|
||||||
// neighbouring coupled patches (so can be swapped)
|
// neighbouring coupled patches (so can be swapped)
|
||||||
globalPoints(const polyMesh& mesh, const bool keepAllPoints);
|
// mergeSeparated:
|
||||||
|
// true : merge coupled points across separated patches.
|
||||||
|
// false : do not merge across coupled separated patches.
|
||||||
|
globalPoints
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const bool keepAllPoints,
|
||||||
|
const bool mergeSeparated
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from mesh and patch of coupled faces. Difference with
|
//- Construct from mesh and patch of coupled faces. Difference with
|
||||||
// construct from mesh only is that this stores the meshToProcPoint,
|
// construct from mesh only is that this stores the meshToProcPoint,
|
||||||
@ -286,7 +366,8 @@ public:
|
|||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const indirectPrimitivePatch& coupledPatch,
|
const indirectPrimitivePatch& coupledPatch,
|
||||||
const bool keepAllPoints
|
const bool keepAllPoints,
|
||||||
|
const bool mergeSeparated
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -206,6 +206,15 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
|||||||
}
|
}
|
||||||
else if (mag(magSf - nbrMagSf)/avSf > coupledPolyPatch::matchTol)
|
else if (mag(magSf - nbrMagSf)/avSf > coupledPolyPatch::matchTol)
|
||||||
{
|
{
|
||||||
|
fileName nm
|
||||||
|
(
|
||||||
|
boundaryMesh().mesh().time().path()
|
||||||
|
/name()+"_faces.obj"
|
||||||
|
);
|
||||||
|
Pout<< "processorPolyPatch::order : Writing my " << size()
|
||||||
|
<< " faces to OBJ file " << nm << endl;
|
||||||
|
writeOBJ(nm, *this, points());
|
||||||
|
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"processorPolyPatch::calcGeometry()"
|
"processorPolyPatch::calcGeometry()"
|
||||||
|
|||||||
@ -61,7 +61,33 @@ Foam::displacementFvMotionSolver::displacementFvMotionSolver
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{}
|
{
|
||||||
|
if (points0_.size() != mesh.nPoints())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"displacementFvMotionSolver::displacementFvMotionSolver\n"
|
||||||
|
"(\n"
|
||||||
|
" const polyMesh&,\n"
|
||||||
|
" Istream&\n"
|
||||||
|
")"
|
||||||
|
) << "Number of points in mesh " << mesh.nPoints()
|
||||||
|
<< " differs from number of points " << points0_.size()
|
||||||
|
<< " read from file "
|
||||||
|
<<
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"points",
|
||||||
|
mesh.time().constant(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
).filePath()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -114,6 +114,32 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void sixDoFRigidBodyDisplacementPointPatchVectorField::autoMap
|
||||||
|
(
|
||||||
|
const pointPatchFieldMapper& m
|
||||||
|
)
|
||||||
|
{
|
||||||
|
fixedValuePointPatchField<vector>::autoMap(m);
|
||||||
|
|
||||||
|
p0_.autoMap(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void sixDoFRigidBodyDisplacementPointPatchVectorField::rmap
|
||||||
|
(
|
||||||
|
const pointPatchField<vector>& ptf,
|
||||||
|
const labelList& addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const sixDoFRigidBodyDisplacementPointPatchVectorField& sDoFptf =
|
||||||
|
refCast<const sixDoFRigidBodyDisplacementPointPatchVectorField>(ptf);
|
||||||
|
|
||||||
|
fixedValuePointPatchField<vector>::rmap(sDoFptf, addr);
|
||||||
|
|
||||||
|
p0_.rmap(sDoFptf.p0_, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
||||||
{
|
{
|
||||||
if (this->updated())
|
if (this->updated())
|
||||||
@ -160,26 +186,6 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
|||||||
t.deltaTValue()
|
t.deltaTValue()
|
||||||
);
|
);
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// vector rotationAxis(0, 1, 0);
|
|
||||||
|
|
||||||
// vector torque
|
|
||||||
// (
|
|
||||||
// (
|
|
||||||
// (fm.second().first() + fm.second().second())
|
|
||||||
// & rotationAxis
|
|
||||||
// )
|
|
||||||
// *rotationAxis
|
|
||||||
// );
|
|
||||||
|
|
||||||
// motion_.updateForce
|
|
||||||
// (
|
|
||||||
// vector::zero, // Force no centre of mass motion
|
|
||||||
// torque, // Only rotation allowed around the unit rotationAxis
|
|
||||||
// t.deltaTValue()
|
|
||||||
// );
|
|
||||||
// ----------------------------------------
|
|
||||||
|
|
||||||
Field<vector>::operator=(motion_.currentPosition(p0_) - p0_);
|
Field<vector>::operator=(motion_.currentPosition(p0_) - p0_);
|
||||||
|
|
||||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||||
|
|||||||
@ -135,6 +135,22 @@ public:
|
|||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|
||||||
|
// Mapping functions
|
||||||
|
|
||||||
|
//- Map (and resize as needed) from self given a mapping object
|
||||||
|
virtual void autoMap
|
||||||
|
(
|
||||||
|
const pointPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Reverse map the given pointPatchField onto this pointPatchField
|
||||||
|
virtual void rmap
|
||||||
|
(
|
||||||
|
const pointPatchField<vector>&,
|
||||||
|
const labelList&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Evaluation functions
|
// Evaluation functions
|
||||||
|
|
||||||
//- Update the coefficients associated with the patch field
|
//- Update the coefficients associated with the patch field
|
||||||
|
|||||||
@ -30,10 +30,20 @@ License
|
|||||||
|
|
||||||
void Foam::sixDoFRigidBodyMotion::applyRestraints()
|
void Foam::sixDoFRigidBodyMotion::applyRestraints()
|
||||||
{
|
{
|
||||||
|
if (restraints_.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
forAll(restraints_, rI)
|
forAll(restraints_, rI)
|
||||||
{
|
{
|
||||||
|
if (report_)
|
||||||
|
{
|
||||||
|
Info<< "Restraint " << restraintNames_[rI];
|
||||||
|
}
|
||||||
|
|
||||||
// restraint position
|
// restraint position
|
||||||
point rP = vector::zero;
|
point rP = vector::zero;
|
||||||
|
|
||||||
@ -57,9 +67,14 @@ void Foam::sixDoFRigidBodyMotion::applyRestraints()
|
|||||||
|
|
||||||
void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
||||||
{
|
{
|
||||||
|
if (constraints_.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
label iter = 0;
|
label iteration = 0;
|
||||||
|
|
||||||
bool allConverged = true;
|
bool allConverged = true;
|
||||||
|
|
||||||
@ -75,6 +90,11 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
|||||||
|
|
||||||
forAll(constraints_, cI)
|
forAll(constraints_, cI)
|
||||||
{
|
{
|
||||||
|
if (report_)
|
||||||
|
{
|
||||||
|
Info<< "Constraint " << constraintNames_[cI];
|
||||||
|
}
|
||||||
|
|
||||||
// constraint position
|
// constraint position
|
||||||
point cP = vector::zero;
|
point cP = vector::zero;
|
||||||
|
|
||||||
@ -104,9 +124,9 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
|||||||
cMA += cM + ((cP - centreOfMass()) ^ cF);
|
cMA += cM + ((cP - centreOfMass()) ^ cF);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while(++iter < maxConstraintIters_ && !allConverged);
|
} while(++iteration < maxConstraintIterations_ && !allConverged);
|
||||||
|
|
||||||
if (iter >= maxConstraintIters_)
|
if (iteration >= maxConstraintIterations_)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
@ -114,13 +134,15 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
|||||||
"(scalar deltaT)"
|
"(scalar deltaT)"
|
||||||
)
|
)
|
||||||
<< nl << "Maximum number of sixDoFRigidBodyMotion constraint "
|
<< nl << "Maximum number of sixDoFRigidBodyMotion constraint "
|
||||||
<< "iterations (" << maxConstraintIters_ << ") exceeded." << nl
|
<< "iterations ("
|
||||||
|
<< maxConstraintIterations_
|
||||||
|
<< ") exceeded." << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
else if (report_)
|
else if (report_)
|
||||||
{
|
{
|
||||||
Info<< "sixDoFRigidBodyMotion constraints converged in "
|
Info<< "sixDoFRigidBodyMotion constraints converged in "
|
||||||
<< iter << " iterations"
|
<< iteration << " iterations"
|
||||||
<< nl << "Constraint force: " << cFA << nl
|
<< nl << "Constraint force: " << cFA << nl
|
||||||
<< "Constraint moment: " << cMA
|
<< "Constraint moment: " << cMA
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -143,8 +165,10 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
|
|||||||
:
|
:
|
||||||
motionState_(),
|
motionState_(),
|
||||||
restraints_(),
|
restraints_(),
|
||||||
|
restraintNames_(),
|
||||||
constraints_(),
|
constraints_(),
|
||||||
maxConstraintIters_(0),
|
constraintNames_(),
|
||||||
|
maxConstraintIterations_(0),
|
||||||
refCentreOfMass_(vector::zero),
|
refCentreOfMass_(vector::zero),
|
||||||
momentOfInertia_(diagTensor::one*VSMALL),
|
momentOfInertia_(diagTensor::one*VSMALL),
|
||||||
mass_(VSMALL),
|
mass_(VSMALL),
|
||||||
@ -176,8 +200,10 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
tau
|
tau
|
||||||
),
|
),
|
||||||
restraints_(),
|
restraints_(),
|
||||||
|
restraintNames_(),
|
||||||
constraints_(),
|
constraints_(),
|
||||||
maxConstraintIters_(0),
|
constraintNames_(),
|
||||||
|
maxConstraintIterations_(0),
|
||||||
refCentreOfMass_(refCentreOfMass),
|
refCentreOfMass_(refCentreOfMass),
|
||||||
momentOfInertia_(momentOfInertia),
|
momentOfInertia_(momentOfInertia),
|
||||||
mass_(mass),
|
mass_(mass),
|
||||||
@ -189,8 +215,10 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
|
|||||||
:
|
:
|
||||||
motionState_(dict),
|
motionState_(dict),
|
||||||
restraints_(),
|
restraints_(),
|
||||||
|
restraintNames_(),
|
||||||
constraints_(),
|
constraints_(),
|
||||||
maxConstraintIters_(0),
|
constraintNames_(),
|
||||||
|
maxConstraintIterations_(0),
|
||||||
refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())),
|
refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())),
|
||||||
momentOfInertia_(dict.lookup("momentOfInertia")),
|
momentOfInertia_(dict.lookup("momentOfInertia")),
|
||||||
mass_(readScalar(dict.lookup("mass"))),
|
mass_(readScalar(dict.lookup("mass"))),
|
||||||
@ -209,8 +237,10 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
|||||||
:
|
:
|
||||||
motionState_(sDoFRBM.motionState()),
|
motionState_(sDoFRBM.motionState()),
|
||||||
restraints_(sDoFRBM.restraints()),
|
restraints_(sDoFRBM.restraints()),
|
||||||
|
restraintNames_(sDoFRBM.restraintNames()),
|
||||||
constraints_(sDoFRBM.constraints()),
|
constraints_(sDoFRBM.constraints()),
|
||||||
maxConstraintIters_(sDoFRBM.maxConstraintIters()),
|
constraintNames_(sDoFRBM.constraintNames()),
|
||||||
|
maxConstraintIterations_(sDoFRBM.maxConstraintIterations()),
|
||||||
refCentreOfMass_(sDoFRBM.refCentreOfMass()),
|
refCentreOfMass_(sDoFRBM.refCentreOfMass()),
|
||||||
momentOfInertia_(sDoFRBM.momentOfInertia()),
|
momentOfInertia_(sDoFRBM.momentOfInertia()),
|
||||||
mass_(sDoFRBM.mass()),
|
mass_(sDoFRBM.mass()),
|
||||||
@ -239,23 +269,29 @@ void Foam::sixDoFRigidBodyMotion::addRestraints
|
|||||||
|
|
||||||
restraints_.setSize(restraintDict.size());
|
restraints_.setSize(restraintDict.size());
|
||||||
|
|
||||||
|
restraintNames_.setSize(restraintDict.size());
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, restraintDict, iter)
|
forAllConstIter(IDLList<entry>, restraintDict, iter)
|
||||||
{
|
{
|
||||||
if (iter().isDict())
|
if (iter().isDict())
|
||||||
{
|
{
|
||||||
Info<< "Adding restraint: " << iter().keyword() << endl;
|
// Info<< "Adding restraint: " << iter().keyword() << endl;
|
||||||
|
|
||||||
restraints_.set
|
restraints_.set
|
||||||
(
|
(
|
||||||
i,
|
i,
|
||||||
sixDoFRigidBodyMotionRestraint::New(iter().dict())
|
sixDoFRigidBodyMotionRestraint::New(iter().dict())
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
restraintNames_[i] = iter().keyword();
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
restraints_.setSize(i);
|
restraints_.setSize(i);
|
||||||
|
|
||||||
|
restraintNames_.setSize(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,25 +309,33 @@ void Foam::sixDoFRigidBodyMotion::addConstraints
|
|||||||
|
|
||||||
constraints_.setSize(constraintDict.size());
|
constraints_.setSize(constraintDict.size());
|
||||||
|
|
||||||
|
constraintNames_.setSize(constraintDict.size());
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, constraintDict, iter)
|
forAllConstIter(IDLList<entry>, constraintDict, iter)
|
||||||
{
|
{
|
||||||
if (iter().isDict())
|
if (iter().isDict())
|
||||||
{
|
{
|
||||||
Info<< "Adding constraint: " << iter().keyword() << endl;
|
// Info<< "Adding constraint: " << iter().keyword() << endl;
|
||||||
|
|
||||||
constraints_.set
|
constraints_.set
|
||||||
(
|
(
|
||||||
i++,
|
i,
|
||||||
sixDoFRigidBodyMotionConstraint::New(iter().dict())
|
sixDoFRigidBodyMotionConstraint::New(iter().dict())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
constraintNames_[i] = iter().keyword();
|
||||||
|
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constraints_.setSize(i);
|
constraints_.setSize(i);
|
||||||
|
|
||||||
if (constraints_.size())
|
constraintNames_.setSize(i);
|
||||||
|
|
||||||
|
if (!constraints_.empty())
|
||||||
{
|
{
|
||||||
maxConstraintIters_ = readLabel
|
maxConstraintIterations_ = readLabel
|
||||||
(
|
(
|
||||||
constraintDict.lookup("maxIterations")
|
constraintDict.lookup("maxIterations")
|
||||||
);
|
);
|
||||||
|
|||||||
@ -91,12 +91,18 @@ class sixDoFRigidBodyMotion
|
|||||||
//- Restraints on the motion
|
//- Restraints on the motion
|
||||||
PtrList<sixDoFRigidBodyMotionRestraint> restraints_;
|
PtrList<sixDoFRigidBodyMotionRestraint> restraints_;
|
||||||
|
|
||||||
|
//- Names of the restraints
|
||||||
|
wordList restraintNames_;
|
||||||
|
|
||||||
//- Constaints on the motion
|
//- Constaints on the motion
|
||||||
PtrList<sixDoFRigidBodyMotionConstraint> constraints_;
|
PtrList<sixDoFRigidBodyMotionConstraint> constraints_;
|
||||||
|
|
||||||
|
//- Names of the constraints
|
||||||
|
wordList constraintNames_;
|
||||||
|
|
||||||
//- Maximum number of iterations allowed to attempt to obey
|
//- Maximum number of iterations allowed to attempt to obey
|
||||||
// constraints
|
// constraints
|
||||||
label maxConstraintIters_;
|
label maxConstraintIterations_;
|
||||||
|
|
||||||
//- Centre of mass of reference state
|
//- Centre of mass of reference state
|
||||||
point refCentreOfMass_;
|
point refCentreOfMass_;
|
||||||
@ -146,13 +152,19 @@ class sixDoFRigidBodyMotion
|
|||||||
inline const PtrList<sixDoFRigidBodyMotionRestraint>&
|
inline const PtrList<sixDoFRigidBodyMotionRestraint>&
|
||||||
restraints() const;
|
restraints() const;
|
||||||
|
|
||||||
|
//- Return access to the restraintNames
|
||||||
|
inline const wordList& restraintNames() const;
|
||||||
|
|
||||||
//- Return access to the constraints
|
//- Return access to the constraints
|
||||||
inline const PtrList<sixDoFRigidBodyMotionConstraint>&
|
inline const PtrList<sixDoFRigidBodyMotionConstraint>&
|
||||||
constraints() const;
|
constraints() const;
|
||||||
|
|
||||||
|
//- Return access to the constraintNames
|
||||||
|
inline const wordList& constraintNames() const;
|
||||||
|
|
||||||
//- Return access to the maximum allowed number of
|
//- Return access to the maximum allowed number of
|
||||||
// constraint iterations
|
// constraint iterations
|
||||||
inline label maxConstraintIters() const;
|
inline label maxConstraintIterations() const;
|
||||||
|
|
||||||
//- Return access to the centre of mass
|
//- Return access to the centre of mass
|
||||||
inline const point& refCentreOfMass() const;
|
inline const point& refCentreOfMass() const;
|
||||||
|
|||||||
@ -123,8 +123,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::constrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Constraint " << this->name()
|
Info<< " angle " << theta
|
||||||
<< " angle " << theta
|
|
||||||
<< " force " << constraintForceIncrement
|
<< " force " << constraintForceIncrement
|
||||||
<< " moment " << constraintMomentIncrement;
|
<< " moment " << constraintMomentIncrement;
|
||||||
|
|
||||||
@ -175,4 +174,14 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("axis")
|
||||||
|
<< fixedAxis_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -111,6 +111,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -109,8 +109,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedLine::constrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Constraint " << this->name()
|
Info<< " error " << error
|
||||||
<< " error << " << error
|
|
||||||
<< " force " << constraintForceIncrement
|
<< " force " << constraintForceIncrement
|
||||||
<< " moment " << constraintMomentIncrement;
|
<< " moment " << constraintMomentIncrement;
|
||||||
|
|
||||||
@ -163,4 +162,17 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedLine::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionConstraints::fixedLine::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("refPoint")
|
||||||
|
<< refPt_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("direction")
|
||||||
|
<< dir_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -112,6 +112,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -150,8 +150,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedOrientation::constrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Constraint " << this->name()
|
Info<< " max angle " << maxTheta
|
||||||
<< " max angle " << maxTheta
|
|
||||||
<< " force " << constraintForceIncrement
|
<< " force " << constraintForceIncrement
|
||||||
<< " moment " << constraintMomentIncrement;
|
<< " moment " << constraintMomentIncrement;
|
||||||
|
|
||||||
@ -198,4 +197,14 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedOrientation::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionConstraints::fixedOrientation::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("fixedOrientation")
|
||||||
|
<< fixedOrientation_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -112,6 +112,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -109,8 +109,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedPlane::constrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Constraint " << this->name()
|
Info<< " error " << error
|
||||||
<< " error " << error
|
|
||||||
<< " force " << constraintForceIncrement
|
<< " force " << constraintForceIncrement
|
||||||
<< " moment " << constraintMomentIncrement;
|
<< " moment " << constraintMomentIncrement;
|
||||||
|
|
||||||
@ -146,4 +145,17 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedPlane::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionConstraints::fixedPlane::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("refPoint")
|
||||||
|
<< fixedPlane_.refPoint() << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("normal")
|
||||||
|
<< fixedPlane_.normal() << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -110,6 +110,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -118,8 +118,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::constrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Constraint " << this->name()
|
Info<< " error " << error
|
||||||
<< " error " << error
|
|
||||||
<< " force " << constraintForceIncrement
|
<< " force " << constraintForceIncrement
|
||||||
<< " moment " << constraintMomentIncrement;
|
<< " moment " << constraintMomentIncrement;
|
||||||
|
|
||||||
@ -151,4 +150,14 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("fixedPoint")
|
||||||
|
<< fixedPoint_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -111,6 +111,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,8 @@ Foam::sixDoFRigidBodyMotionConstraint::New(const dictionary& sDoFRBMCDict)
|
|||||||
word sixDoFRigidBodyMotionConstraintTypeName =
|
word sixDoFRigidBodyMotionConstraintTypeName =
|
||||||
sDoFRBMCDict.lookup("sixDoFRigidBodyMotionConstraint");
|
sDoFRBMCDict.lookup("sixDoFRigidBodyMotionConstraint");
|
||||||
|
|
||||||
Info<< "Selecting sixDoFRigidBodyMotionConstraint function "
|
// Info<< "Selecting sixDoFRigidBodyMotionConstraint function "
|
||||||
<< sixDoFRigidBodyMotionConstraintTypeName << endl;
|
// << sixDoFRigidBodyMotionConstraintTypeName << endl;
|
||||||
|
|
||||||
dictionaryConstructorTable::iterator cstrIter =
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
dictionaryConstructorTablePtr_->find
|
dictionaryConstructorTablePtr_->find
|
||||||
|
|||||||
@ -39,7 +39,6 @@ Foam::sixDoFRigidBodyMotionConstraint::sixDoFRigidBodyMotionConstraint
|
|||||||
const dictionary& sDoFRBMCDict
|
const dictionary& sDoFRBMCDict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(fileName(sDoFRBMCDict.name().name()).components(token::COLON).last()),
|
|
||||||
sDoFRBMCCoeffs_
|
sDoFRBMCCoeffs_
|
||||||
(
|
(
|
||||||
sDoFRBMCDict.subDict
|
sDoFRBMCDict.subDict
|
||||||
@ -83,4 +82,13 @@ bool Foam::sixDoFRigidBodyMotionConstraint::read
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionConstraint::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("tolerance")
|
||||||
|
<< tolerance_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("relaxationFactor")
|
||||||
|
<< relaxationFactor_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -70,9 +70,6 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of the constraint in dictionary
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Constraint model specific coefficient dictionary
|
//- Constraint model specific coefficient dictionary
|
||||||
dictionary sDoFRBMCCoeffs_;
|
dictionary sDoFRBMCCoeffs_;
|
||||||
|
|
||||||
@ -145,16 +142,10 @@ public:
|
|||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMCDict) = 0;
|
virtual bool read(const dictionary& sDoFRBMCDict);
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return access to the name of the restraint
|
|
||||||
inline const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return access to sDoFRBMCCoeffs
|
// Return access to sDoFRBMCCoeffs
|
||||||
inline const dictionary& coeffDict() const
|
inline const dictionary& coeffDict() const
|
||||||
{
|
{
|
||||||
@ -172,6 +163,9 @@ public:
|
|||||||
{
|
{
|
||||||
return relaxationFactor_;
|
return relaxationFactor_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -107,6 +107,12 @@ Foam::sixDoFRigidBodyMotion::restraints() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::wordList& Foam::sixDoFRigidBodyMotion::restraintNames() const
|
||||||
|
{
|
||||||
|
return restraintNames_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::PtrList<Foam::sixDoFRigidBodyMotionConstraint>&
|
inline const Foam::PtrList<Foam::sixDoFRigidBodyMotionConstraint>&
|
||||||
Foam::sixDoFRigidBodyMotion::constraints() const
|
Foam::sixDoFRigidBodyMotion::constraints() const
|
||||||
{
|
{
|
||||||
@ -114,9 +120,16 @@ Foam::sixDoFRigidBodyMotion::constraints() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::sixDoFRigidBodyMotion::maxConstraintIters() const
|
inline const Foam::wordList&
|
||||||
|
Foam::sixDoFRigidBodyMotion::constraintNames() const
|
||||||
{
|
{
|
||||||
return maxConstraintIters_;
|
return constraintNames_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::sixDoFRigidBodyMotion::maxConstraintIterations() const
|
||||||
|
{
|
||||||
|
return maxConstraintIterations_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -42,68 +42,67 @@ void Foam::sixDoFRigidBodyMotion::write(Ostream& os) const
|
|||||||
os.writeKeyword("report")
|
os.writeKeyword("report")
|
||||||
<< report_ << token::END_STATEMENT << nl;
|
<< report_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (restraints_.size())
|
if (!restraints_.empty())
|
||||||
{
|
{
|
||||||
dictionary restraintsDict;
|
os << indent << "restraints" << nl
|
||||||
|
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
|
||||||
forAll(restraints_, rI)
|
forAll(restraints_, rI)
|
||||||
{
|
{
|
||||||
word restraintType = restraints_[rI].type();
|
word restraintType = restraints_[rI].type();
|
||||||
|
|
||||||
dictionary restraintDict;
|
os << indent << restraintNames_[rI] << nl
|
||||||
|
<< indent << token::BEGIN_BLOCK << incrIndent << endl;
|
||||||
|
|
||||||
restraintDict.add("sixDoFRigidBodyMotionRestraint", restraintType);
|
os.writeKeyword("sixDoFRigidBodyMotionRestraint")
|
||||||
|
<< restraintType << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
restraintDict.add
|
os.writeKeyword(word(restraintType + "Coeffs")) << nl;
|
||||||
(
|
|
||||||
word(restraintType + "Coeffs"), restraints_[rI].coeffDict()
|
|
||||||
);
|
|
||||||
|
|
||||||
restraintsDict.add(restraints_[rI].name(), restraintDict);
|
os << indent << token::BEGIN_BLOCK << nl << incrIndent;
|
||||||
|
|
||||||
|
restraints_[rI].write(os);
|
||||||
|
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << nl;
|
||||||
|
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os.writeKeyword("restraints") << restraintsDict;
|
os << decrIndent << indent << token::END_BLOCK << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (constraints_.size())
|
if (!constraints_.empty())
|
||||||
{
|
{
|
||||||
dictionary constraintsDict;
|
os << indent << "constraints" << nl
|
||||||
|
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
|
||||||
constraintsDict.add("maxIterations", maxConstraintIters_);
|
os.writeKeyword("maxIterations")
|
||||||
|
<< maxConstraintIterations_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
forAll(constraints_, rI)
|
forAll(constraints_, rI)
|
||||||
{
|
{
|
||||||
word constraintType = constraints_[rI].type();
|
word constraintType = constraints_[rI].type();
|
||||||
|
|
||||||
dictionary constraintDict;
|
os << indent << constraintNames_[rI] << nl
|
||||||
|
<< indent << token::BEGIN_BLOCK << incrIndent << endl;
|
||||||
|
|
||||||
constraintDict.add
|
os.writeKeyword("sixDoFRigidBodyMotionConstraint")
|
||||||
(
|
<< constraintType << token::END_STATEMENT << nl;
|
||||||
"sixDoFRigidBodyMotionConstraint",
|
|
||||||
constraintType
|
|
||||||
);
|
|
||||||
|
|
||||||
constraintDict.add
|
constraints_[rI].sixDoFRigidBodyMotionConstraint::write(os);
|
||||||
(
|
|
||||||
"tolerance",
|
|
||||||
constraints_[rI].tolerance()
|
|
||||||
);
|
|
||||||
|
|
||||||
constraintDict.add
|
os.writeKeyword(word(constraintType + "Coeffs")) << nl;
|
||||||
(
|
|
||||||
"relaxationFactor",
|
|
||||||
constraints_[rI].relaxationFactor()
|
|
||||||
);
|
|
||||||
|
|
||||||
constraintDict.add
|
os << indent << token::BEGIN_BLOCK << nl << incrIndent;
|
||||||
(
|
|
||||||
word(constraintType + "Coeffs"), constraints_[rI].coeffDict()
|
|
||||||
);
|
|
||||||
|
|
||||||
constraintsDict.add(constraints_[rI].name(), constraintDict);
|
constraints_[rI].write(os);
|
||||||
|
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << nl;
|
||||||
|
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os.writeKeyword("constraints") << constraintsDict;
|
os << decrIndent << indent << token::END_BLOCK << nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -136,8 +136,7 @@ Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::restrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Restraint " << this->name()
|
Info<< " angle " << theta
|
||||||
<< " angle " << theta
|
|
||||||
<< " force " << restraintForce
|
<< " force " << restraintForce
|
||||||
<< " moment " << restraintMoment
|
<< " moment " << restraintMoment
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -199,4 +198,23 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("referenceOrientation")
|
||||||
|
<< refQ_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("axis")
|
||||||
|
<< axis_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("stiffness")
|
||||||
|
<< stiffness_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("damping")
|
||||||
|
<< damping_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -114,6 +114,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -96,8 +96,7 @@ void Foam::sixDoFRigidBodyMotionRestraints::linearSpring::restrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Restraint " << this->name()
|
Info<< " spring length " << magR
|
||||||
<< " spring length " << magR
|
|
||||||
<< " force " << restraintForce
|
<< " force " << restraintForce
|
||||||
<< " moment " << restraintMoment
|
<< " moment " << restraintMoment
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -125,4 +124,26 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearSpring::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionRestraints::linearSpring::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("anchor")
|
||||||
|
<< anchor_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("refAttachmentPt")
|
||||||
|
<< refAttachmentPt_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("stiffness")
|
||||||
|
<< stiffness_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("damping")
|
||||||
|
<< damping_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("restLength")
|
||||||
|
<< restLength_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -117,6 +117,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,8 @@ Foam::sixDoFRigidBodyMotionRestraint::New(const dictionary& sDoFRBMRDict)
|
|||||||
word sixDoFRigidBodyMotionRestraintTypeName =
|
word sixDoFRigidBodyMotionRestraintTypeName =
|
||||||
sDoFRBMRDict.lookup("sixDoFRigidBodyMotionRestraint");
|
sDoFRBMRDict.lookup("sixDoFRigidBodyMotionRestraint");
|
||||||
|
|
||||||
Info<< "Selecting sixDoFRigidBodyMotionRestraint function "
|
// Info<< "Selecting sixDoFRigidBodyMotionRestraint function "
|
||||||
<< sixDoFRigidBodyMotionRestraintTypeName << endl;
|
// << sixDoFRigidBodyMotionRestraintTypeName << endl;
|
||||||
|
|
||||||
dictionaryConstructorTable::iterator cstrIter =
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
dictionaryConstructorTablePtr_->find
|
dictionaryConstructorTablePtr_->find
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------* \
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
@ -39,7 +39,6 @@ Foam::sixDoFRigidBodyMotionRestraint::sixDoFRigidBodyMotionRestraint
|
|||||||
const dictionary& sDoFRBMRDict
|
const dictionary& sDoFRBMRDict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(fileName(sDoFRBMRDict.name().name()).components(token::COLON).last()),
|
|
||||||
sDoFRBMRCoeffs_
|
sDoFRBMRCoeffs_
|
||||||
(
|
(
|
||||||
sDoFRBMRDict.subDict
|
sDoFRBMRDict.subDict
|
||||||
|
|||||||
@ -70,9 +70,6 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of the constraint in dictionary
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Restraint model specific coefficient dictionary
|
//- Restraint model specific coefficient dictionary
|
||||||
dictionary sDoFRBMRCoeffs_;
|
dictionary sDoFRBMRCoeffs_;
|
||||||
|
|
||||||
@ -134,21 +131,18 @@ public:
|
|||||||
) const = 0;
|
) const = 0;
|
||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMRDict) = 0;
|
virtual bool read(const dictionary& sDoFRBMRDict);
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return access to the name of the restraint
|
|
||||||
inline const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return access to sDoFRBMRCoeffs
|
// Return access to sDoFRBMRCoeffs
|
||||||
inline const dictionary& coeffDict() const
|
inline const dictionary& coeffDict() const
|
||||||
{
|
{
|
||||||
return sDoFRBMRCoeffs_;
|
return sDoFRBMRCoeffs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -113,8 +113,7 @@ Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::restrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Restraint " << this->name()
|
Info<< " force " << restraintForce
|
||||||
<< " force " << restraintForce
|
|
||||||
<< " moment " << restraintMoment
|
<< " moment " << restraintMoment
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -153,4 +152,19 @@ bool Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("referenceOrientation")
|
||||||
|
<< refQ_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("stiffness") << stiffness_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("damping") << damping_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -111,6 +111,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -136,8 +136,7 @@ Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::restrain
|
|||||||
|
|
||||||
if (motion.report())
|
if (motion.report())
|
||||||
{
|
{
|
||||||
Info<< "Restraint " << this->name()
|
Info<< " angle " << theta
|
||||||
<< " angle " << theta
|
|
||||||
<< " force " << restraintForce
|
<< " force " << restraintForce
|
||||||
<< " moment " << restraintMoment
|
<< " moment " << restraintMoment
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -223,4 +222,34 @@ bool Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::write
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeKeyword("referenceOrientation")
|
||||||
|
<< refQ_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
os.writeKeyword("axis")
|
||||||
|
<< axis_ << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
moment_.write(os);
|
||||||
|
|
||||||
|
os.writeKeyword("angleFormat");
|
||||||
|
|
||||||
|
if (convertToDegrees_)
|
||||||
|
{
|
||||||
|
os << "degrees" << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
os << "radians" << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
os.writeKeyword("damping")
|
||||||
|
<< damping_ << token::END_STATEMENT << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -121,6 +121,9 @@ public:
|
|||||||
|
|
||||||
//- Update properties from given dictionary
|
//- Update properties from given dictionary
|
||||||
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type sixDoFRigidBodyDisplacement;
|
type sixDoFRigidBodyDisplacement;
|
||||||
centreOfMass (0.5 0.5 0.5);
|
centreOfMass (0.5 0.5 0.5);
|
||||||
momentOfInertia (0.08622222 0.8622222 0.144);
|
momentOfInertia (0.08622222 0.08622222 0.144);
|
||||||
mass 9.6;
|
mass 9.6;
|
||||||
rhoInf 1; // for forces calculation
|
rhoInf 1; // for forces calculation
|
||||||
// See sixDoFRigidBodyMotionState
|
// See sixDoFRigidBodyMotionState
|
||||||
|
|||||||
Reference in New Issue
Block a user