Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
commit
d2b8b58b5c
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
|
||||
while (runTime.run())
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
@ -81,8 +81,6 @@ int main(int argc, char *argv[])
|
||||
#include "convergenceCheck.H"
|
||||
}
|
||||
|
||||
runTime++;
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
|
@ -53,7 +53,7 @@ int main(int argc, char *argv[])
|
||||
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
|
||||
|
||||
|
||||
// Test:print shared points
|
||||
// Test:print (collocated) shared points
|
||||
{
|
||||
const labelListList& 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 =
|
||||
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 labelListList& globalPointBoundaryCells =
|
||||
@ -172,7 +172,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
|
||||
// Test:print shared edges
|
||||
// Test:print (collocated) shared edges
|
||||
{
|
||||
const labelListList& globalEdgeSlaves =
|
||||
globalData.globalEdgeSlaves();
|
||||
|
@ -46,9 +46,6 @@ Usage
|
||||
@param -fields \n
|
||||
Use existing geometry decomposition and convert fields only.
|
||||
|
||||
@param -filterPatches \n
|
||||
Remove empty patches when decomposing the geometry.
|
||||
|
||||
@param -force \n
|
||||
Remove any existing @a processor subdirectories before decomposing the
|
||||
geometry.
|
||||
@ -99,11 +96,6 @@ int main(int argc, char *argv[])
|
||||
"use existing geometry decomposition and convert fields only"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"filterPatches",
|
||||
"remove empty patches when decomposing the geometry"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"force",
|
||||
"remove existing processor*/ subdirs before decomposing the geometry"
|
||||
@ -128,7 +120,6 @@ int main(int argc, char *argv[])
|
||||
bool writeCellDist = args.optionFound("cellDist");
|
||||
bool copyUniform = args.optionFound("copyUniform");
|
||||
bool decomposeFieldsOnly = args.optionFound("fields");
|
||||
bool filterPatches = args.optionFound("filterPatches");
|
||||
bool forceOverwrite = args.optionFound("force");
|
||||
bool ifRequiredDecomposition = args.optionFound("ifRequired");
|
||||
|
||||
@ -249,7 +240,7 @@ int main(int argc, char *argv[])
|
||||
// Decompose the mesh
|
||||
if (!decomposeFieldsOnly)
|
||||
{
|
||||
mesh.decomposeMesh(filterPatches);
|
||||
mesh.decomposeMesh();
|
||||
|
||||
mesh.writeDecomposition();
|
||||
|
||||
|
@ -69,6 +69,24 @@ void Foam::domainDecomposition::mark
|
||||
Foam::domainDecomposition::domainDecomposition(const IOobject& io)
|
||||
:
|
||||
fvMesh(io),
|
||||
facesInstancePointsPtr_
|
||||
(
|
||||
pointsInstance() != facesInstance()
|
||||
? new pointIOField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"points",
|
||||
facesInstance(),
|
||||
polyMesh::meshSubDir,
|
||||
*this,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
)
|
||||
: NULL
|
||||
),
|
||||
decompositionDict_
|
||||
(
|
||||
IOobject
|
||||
@ -86,7 +104,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io)
|
||||
procPointAddressing_(nProcs_),
|
||||
procFaceAddressing_(nProcs_),
|
||||
procCellAddressing_(nProcs_),
|
||||
procBoundaryAddressing_(nProcs_),
|
||||
procPatchSize_(nProcs_),
|
||||
procPatchStartIndex_(nProcs_),
|
||||
procNeighbourProcessors_(nProcs_),
|
||||
@ -263,24 +280,67 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
"system",
|
||||
"constant"
|
||||
);
|
||||
processorDb.setTime(time());
|
||||
|
||||
// create the mesh
|
||||
polyMesh procMesh
|
||||
(
|
||||
IOobject
|
||||
// create the mesh. Two situations:
|
||||
// - 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
|
||||
(
|
||||
this->polyMesh::name(), // region name of undecomposed mesh
|
||||
pointsInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(procPoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
);
|
||||
facesInstancePointsPtr_(),
|
||||
curPointLabels
|
||||
);
|
||||
|
||||
procMeshPtr.reset
|
||||
(
|
||||
new polyMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->polyMesh::name(), // region of undecomposed mesh
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(facesInstancePoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
procMeshPtr.reset
|
||||
(
|
||||
new polyMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
this->polyMesh::name(), // region of undecomposed mesh
|
||||
facesInstance(),
|
||||
processorDb
|
||||
),
|
||||
xferMove(procPoints),
|
||||
xferMove(procFaces),
|
||||
xferMove(procCells)
|
||||
)
|
||||
);
|
||||
}
|
||||
polyMesh& procMesh = procMeshPtr();
|
||||
|
||||
|
||||
// Create processor boundary patches
|
||||
const labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
|
||||
|
||||
const labelList& curPatchSizes = procPatchSize_[procI];
|
||||
|
||||
const labelList& curPatchStarts = procPatchStartIndex_[procI];
|
||||
@ -309,8 +369,7 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
{
|
||||
// Get the face labels consistent with the field mapping
|
||||
// (reuse the patch field mappers)
|
||||
const polyPatch& meshPatch =
|
||||
meshPatches[curBoundaryAddressing[patchi]];
|
||||
const polyPatch& meshPatch = meshPatches[patchi];
|
||||
|
||||
fvFieldDecomposer::patchFieldDecomposer patchMapper
|
||||
(
|
||||
@ -324,14 +383,13 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
);
|
||||
|
||||
// Map existing patches
|
||||
procPatches[nPatches] =
|
||||
meshPatches[curBoundaryAddressing[patchi]].clone
|
||||
(
|
||||
procMesh.boundaryMesh(),
|
||||
nPatches,
|
||||
patchMapper.directAddressing(),
|
||||
curPatchStarts[patchi]
|
||||
).ptr();
|
||||
procPatches[nPatches] = meshPatch.clone
|
||||
(
|
||||
procMesh.boundaryMesh(),
|
||||
nPatches,
|
||||
patchMapper.directAddressing(),
|
||||
curPatchStarts[patchi]
|
||||
).ptr();
|
||||
|
||||
nPatches++;
|
||||
}
|
||||
@ -589,6 +647,26 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
|
||||
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
|
||||
<< "Processor " << procI << nl
|
||||
<< " Number of cells = " << procMesh.nCells()
|
||||
@ -678,6 +756,16 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
);
|
||||
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
|
||||
(
|
||||
IOobject
|
||||
@ -689,7 +777,7 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
procBoundaryAddressing_[procI]
|
||||
procBoundaryAddressing
|
||||
);
|
||||
boundaryProcAddressing.write();
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ class domainDecomposition
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Optional: points at the facesInstance
|
||||
autoPtr<pointIOField> facesInstancePointsPtr_;
|
||||
|
||||
//- Mesh decomposition control dictionary
|
||||
IOdictionary decompositionDict_;
|
||||
|
||||
@ -83,9 +86,6 @@ class domainDecomposition
|
||||
//- Labels of cells for each processor
|
||||
labelListList procCellAddressing_;
|
||||
|
||||
//- Original patch index for every processor patch
|
||||
labelListList procBoundaryAddressing_;
|
||||
|
||||
//- Sizes for processor mesh patches
|
||||
// Excludes inter-processor boundaries
|
||||
labelListList procPatchSize_;
|
||||
@ -149,8 +149,8 @@ public:
|
||||
return distributed_;
|
||||
}
|
||||
|
||||
//- Decompose mesh. Optionally remove zero-sized patches.
|
||||
void decomposeMesh(const bool filterEmptyPatches);
|
||||
//- Decompose mesh.
|
||||
void decomposeMesh();
|
||||
|
||||
//- Write decomposition
|
||||
bool writeDecomposition();
|
||||
|
@ -40,7 +40,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
void Foam::domainDecomposition::decomposeMesh()
|
||||
{
|
||||
// Decide which cell goes to which processor
|
||||
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;
|
||||
// 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ignore special fields or fields that we don't handle
|
||||
//
|
||||
bool variableGood = true;
|
||||
for (label n1=startTime; n1<endTime && variableGood; ++n1)
|
||||
for (label n1=0; n1<Times.size() && variableGood; ++n1)
|
||||
{
|
||||
// ignore _0 fields
|
||||
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")
|
||||
|
@ -19,7 +19,7 @@ if (Pstream::master())
|
||||
Info<< "Correcting time values. Adding " << Tcorr << endl;
|
||||
}
|
||||
|
||||
for (int n=startTime; n<endTime; n++)
|
||||
forAll(Times, n)
|
||||
{
|
||||
ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " ";
|
||||
|
||||
|
@ -185,7 +185,6 @@ void writeAllFaceData
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const Field<Type>& pf,
|
||||
const labelList& patchProcessors,
|
||||
OFstream& ensightFile
|
||||
)
|
||||
{
|
||||
@ -199,16 +198,12 @@ void writeAllFaceData
|
||||
{
|
||||
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);
|
||||
scalarField pf(fromSlave);
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField pf(fromSlave);
|
||||
|
||||
writeData(pf, ensightFile);
|
||||
}
|
||||
writeData(pf, ensightFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -231,7 +226,6 @@ void writeAllFaceDataBinary
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const Field<Type>& pf,
|
||||
const labelList& patchProcessors,
|
||||
std::ofstream& ensightFile
|
||||
)
|
||||
{
|
||||
@ -245,16 +239,12 @@ void writeAllFaceDataBinary
|
||||
{
|
||||
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);
|
||||
scalarField pf(fromSlave);
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
scalarField pf(fromSlave);
|
||||
|
||||
writeEnsDataBinary(pf, ensightFile);
|
||||
}
|
||||
writeEnsDataBinary(pf, ensightFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,7 +268,6 @@ bool writePatchField
|
||||
const Foam::label ensightPatchI,
|
||||
const Foam::faceSets& boundaryFaceSet,
|
||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
||||
const Foam::labelList& patchProcessors,
|
||||
Foam::OFstream& ensightFile
|
||||
)
|
||||
{
|
||||
@ -297,7 +286,6 @@ bool writePatchField
|
||||
boundaryFaceSet.tris,
|
||||
nfp.nTris,
|
||||
pf,
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
);
|
||||
|
||||
@ -307,7 +295,6 @@ bool writePatchField
|
||||
boundaryFaceSet.quads,
|
||||
nfp.nQuads,
|
||||
pf,
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
);
|
||||
|
||||
@ -317,7 +304,6 @@ bool writePatchField
|
||||
boundaryFaceSet.polys,
|
||||
nfp.nPolys,
|
||||
pf,
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
);
|
||||
|
||||
@ -338,7 +324,6 @@ bool writePatchFieldBinary
|
||||
const Foam::label ensightPatchI,
|
||||
const Foam::faceSets& boundaryFaceSet,
|
||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
||||
const Foam::labelList& patchProcessors,
|
||||
std::ofstream& ensightFile
|
||||
)
|
||||
{
|
||||
@ -356,7 +341,6 @@ bool writePatchFieldBinary
|
||||
boundaryFaceSet.tris,
|
||||
nfp.nTris,
|
||||
pf,
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
);
|
||||
|
||||
@ -366,7 +350,6 @@ bool writePatchFieldBinary
|
||||
boundaryFaceSet.quads,
|
||||
nfp.nQuads,
|
||||
pf,
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
);
|
||||
|
||||
@ -376,7 +359,6 @@ bool writePatchFieldBinary
|
||||
boundaryFaceSet.polys,
|
||||
nfp.nPolys,
|
||||
pf,
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
);
|
||||
|
||||
@ -406,7 +388,6 @@ void writePatchField
|
||||
|
||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
||||
const HashTable<ensightMesh::nFacePrimitives>&
|
||||
nPatchPrims = eMesh.nPatchPrims();
|
||||
|
||||
@ -425,8 +406,6 @@ void writePatchField
|
||||
}
|
||||
|
||||
|
||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
||||
|
||||
word pfName = patchName + '.' + fieldName;
|
||||
|
||||
word timeFile = prepend + itoa(timeIndex);
|
||||
@ -473,7 +452,6 @@ void writePatchField
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
);
|
||||
}
|
||||
@ -488,7 +466,6 @@ void writePatchField
|
||||
ensightPatchI,
|
||||
nullFaceSets,
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
);
|
||||
}
|
||||
@ -521,7 +498,6 @@ void ensightFieldAscii
|
||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
||||
const wordHashSet& patchNames = eMesh.patchNames();
|
||||
const HashTable<ensightMesh::nFacePrimitives>&
|
||||
nPatchPrims = eMesh.nPatchPrims();
|
||||
@ -619,50 +595,23 @@ void ensightFieldAscii
|
||||
forAll(allPatchNames, patchi)
|
||||
{
|
||||
const word& patchName = allPatchNames[patchi];
|
||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
||||
|
||||
if (patchNames.empty() || patchNames.found(patchName))
|
||||
{
|
||||
if (mesh.boundary()[patchi].size())
|
||||
{
|
||||
if
|
||||
if
|
||||
(
|
||||
writePatchField
|
||||
(
|
||||
writePatchField
|
||||
(
|
||||
vf.boundaryField()[patchi],
|
||||
patchi,
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
)
|
||||
vf.boundaryField()[patchi],
|
||||
patchi,
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
ensightFile
|
||||
)
|
||||
{
|
||||
ensightPatchI++;
|
||||
}
|
||||
|
||||
}
|
||||
else if (Pstream::master())
|
||||
)
|
||||
{
|
||||
faceSets nullFaceSet;
|
||||
|
||||
if
|
||||
(
|
||||
writePatchField
|
||||
(
|
||||
Field<Type>(),
|
||||
-1,
|
||||
ensightPatchI,
|
||||
nullFaceSet,
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
)
|
||||
)
|
||||
{
|
||||
ensightPatchI++;
|
||||
}
|
||||
ensightPatchI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -695,7 +644,6 @@ void ensightFieldBinary
|
||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
||||
const wordHashSet& patchNames = eMesh.patchNames();
|
||||
const HashTable<ensightMesh::nFacePrimitives>&
|
||||
nPatchPrims = eMesh.nPatchPrims();
|
||||
@ -819,50 +767,23 @@ void ensightFieldBinary
|
||||
forAll(allPatchNames, patchi)
|
||||
{
|
||||
const word& patchName = allPatchNames[patchi];
|
||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
||||
|
||||
if (patchNames.empty() || patchNames.found(patchName))
|
||||
{
|
||||
if (mesh.boundary()[patchi].size())
|
||||
{
|
||||
if
|
||||
if
|
||||
(
|
||||
writePatchFieldBinary
|
||||
(
|
||||
writePatchFieldBinary
|
||||
(
|
||||
vf.boundaryField()[patchi],
|
||||
patchi,
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
)
|
||||
vf.boundaryField()[patchi],
|
||||
patchi,
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
ensightFile
|
||||
)
|
||||
{
|
||||
ensightPatchI++;
|
||||
}
|
||||
|
||||
}
|
||||
else if (Pstream::master())
|
||||
)
|
||||
{
|
||||
faceSets nullFaceSet;
|
||||
|
||||
if
|
||||
(
|
||||
writePatchFieldBinary
|
||||
(
|
||||
Field<Type>(),
|
||||
-1,
|
||||
ensightPatchI,
|
||||
nullFaceSet,
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
)
|
||||
)
|
||||
{
|
||||
ensightPatchI++;
|
||||
}
|
||||
ensightPatchI++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,7 @@ SourceFiles
|
||||
#include "fvMesh.H"
|
||||
#include "OFstream.H"
|
||||
#include <fstream>
|
||||
#include "globalIndex.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -62,14 +63,12 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
label nPoints;
|
||||
label nTris;
|
||||
label nQuads;
|
||||
label nPolys;
|
||||
|
||||
nFacePrimitives()
|
||||
:
|
||||
nPoints(0),
|
||||
nTris(0),
|
||||
nQuads(0),
|
||||
nPolys(0)
|
||||
@ -95,8 +94,6 @@ private:
|
||||
|
||||
wordList allPatchNames_;
|
||||
|
||||
List<labelList> allPatchProcs_;
|
||||
|
||||
wordHashSet patchNames_;
|
||||
|
||||
HashTable<nFacePrimitives> nPatchPrims_;
|
||||
@ -119,20 +116,21 @@ private:
|
||||
cellShapeList map
|
||||
(
|
||||
const cellShapeList& cellShapes,
|
||||
const labelList& prims
|
||||
const labelList& prims,
|
||||
const labelList& pointToGlobal
|
||||
) const;
|
||||
|
||||
cellShapeList map
|
||||
(
|
||||
const cellShapeList& cellShapes,
|
||||
const labelList& hexes,
|
||||
const labelList& wedges
|
||||
const labelList& wedges,
|
||||
const labelList& pointToGlobal
|
||||
) const;
|
||||
|
||||
void writePrims
|
||||
(
|
||||
const cellShapeList& cellShapes,
|
||||
const label pointOffset,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -156,13 +154,12 @@ private:
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
const faceList& faces,
|
||||
const label pointOffset,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllPolys
|
||||
(
|
||||
const labelList& pointOffsets,
|
||||
const labelList& pointToGlobal,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -171,31 +168,21 @@ private:
|
||||
const char* key,
|
||||
const label nPrims,
|
||||
const cellShapeList& cellShapes,
|
||||
const labelList& pointOffsets,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeFacePrims
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
faceList map
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const labelList& prims
|
||||
) const;
|
||||
|
||||
void writeAllFacePrims
|
||||
(
|
||||
const char* key,
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const faceList& patchFaces,
|
||||
const labelList& pointOffsets,
|
||||
const labelList& patchProcessors,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -208,7 +195,6 @@ private:
|
||||
void writeNSidedPoints
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -217,8 +203,6 @@ private:
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const faceList& patchFaces,
|
||||
const labelList& pointOffsets,
|
||||
const labelList& patchProcessors,
|
||||
OFstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -227,7 +211,10 @@ private:
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const label timeIndex,
|
||||
Ostream& ensightCaseFile
|
||||
Ostream& ensightCaseFile,
|
||||
const labelList& pointToGlobal,
|
||||
const pointField& uniquePoints,
|
||||
const globalIndex& globalPoints
|
||||
) const;
|
||||
|
||||
void writeBinary
|
||||
@ -235,13 +222,15 @@ private:
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const label timeIndex,
|
||||
Ostream& ensightCaseFile
|
||||
Ostream& ensightCaseFile,
|
||||
const labelList& pointToGlobal,
|
||||
const pointField& uniquePoints,
|
||||
const globalIndex& globalPoints
|
||||
) const;
|
||||
|
||||
void writePrimsBinary
|
||||
(
|
||||
const cellShapeList& cellShapes,
|
||||
const label pointOffset,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -250,7 +239,6 @@ private:
|
||||
const char* key,
|
||||
const label nPrims,
|
||||
const cellShapeList& cellShapes,
|
||||
const labelList& pointOffsets,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -274,13 +262,12 @@ private:
|
||||
const labelList& polys,
|
||||
const cellList& cellFaces,
|
||||
const faceList& faces,
|
||||
const label pointOffset,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeAllPolysBinary
|
||||
(
|
||||
const labelList& pointOffsets,
|
||||
const labelList& pointToGlobal,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -290,22 +277,18 @@ private:
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const faceList& patchFaces,
|
||||
const labelList& pointOffsets,
|
||||
const labelList& patchProcessors,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeFacePrimsBinary
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
void writeNSidedPointsBinary
|
||||
(
|
||||
const faceList& patchFaces,
|
||||
const label pointOffset,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -320,8 +303,6 @@ private:
|
||||
const labelList& prims,
|
||||
const label nPrims,
|
||||
const faceList& patchFaces,
|
||||
const labelList& pointOffsets,
|
||||
const labelList& patchProcessors,
|
||||
std::ofstream& ensightGeometryFile
|
||||
) const;
|
||||
|
||||
@ -361,11 +342,6 @@ public:
|
||||
return allPatchNames_;
|
||||
}
|
||||
|
||||
const List<labelList>& allPatchProcs() const
|
||||
{
|
||||
return allPatchProcs_;
|
||||
}
|
||||
|
||||
const wordHashSet& patchNames() const
|
||||
{
|
||||
return patchNames_;
|
||||
|
@ -93,6 +93,9 @@ bool inFileNameList
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions();
|
||||
# include "addRegionOption.H"
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"ascii",
|
||||
@ -111,7 +114,6 @@ int main(int argc, char *argv[])
|
||||
"An empty list suppresses writing the internalMesh."
|
||||
);
|
||||
|
||||
# include "addTimeOptions.H"
|
||||
# include "setRootCase.H"
|
||||
|
||||
// Check options
|
||||
@ -119,12 +121,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
# include "createTime.H"
|
||||
|
||||
// get the available time-steps
|
||||
instantList Times = runTime.times();
|
||||
|
||||
# include "checkTimeOptions.H"
|
||||
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
instantList Times = timeSelector::select0(runTime, args);
|
||||
|
||||
# include "createNamedMesh.H"
|
||||
|
||||
@ -214,9 +211,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Identify if lagrangian data exists at each time, and add clouds
|
||||
// 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
|
||||
(
|
||||
@ -267,9 +264,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Loop over all times to build list of fields and field types
|
||||
// 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
|
||||
(
|
||||
@ -296,20 +293,19 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
label nTimeSteps = 0;
|
||||
for (label n=startTime; n<endTime; n++)
|
||||
forAll(Times, timeIndex)
|
||||
{
|
||||
nTimeSteps++;
|
||||
runTime.setTime(Times[n], n);
|
||||
label timeIndex = n - startTime;
|
||||
runTime.setTime(Times[timeIndex], timeIndex);
|
||||
|
||||
word timeName = itoa(timeIndex);
|
||||
word timeFile = prepend + timeName;
|
||||
|
||||
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
|
||||
(
|
||||
|
@ -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 "meshTools.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);
|
||||
|
||||
tensor eVec = eigenVectors(J);
|
||||
@ -380,19 +389,221 @@ int main(int argc, char *argv[])
|
||||
pertI++;
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Density = " << density << nl
|
||||
<< "Mass = " << m << nl
|
||||
<< "Centre of mass = " << cM << nl
|
||||
<< "Inertia tensor around centre of mass = " << J << nl
|
||||
<< "eigenValues (principal moments) = " << eVal << nl
|
||||
<< "eigenVectors (principal axes) = "
|
||||
<< eVec.x() << ' ' << eVec.y() << ' ' << eVec.z()
|
||||
<< endl;
|
||||
bool showTransform = true;
|
||||
|
||||
if
|
||||
(
|
||||
(mag(eVec.x() ^ eVec.y()) > (1.0 - SMALL))
|
||||
&& (mag(eVec.y() ^ eVec.z()) > (1.0 - SMALL))
|
||||
&& (mag(eVec.z() ^ eVec.x()) > (1.0 - SMALL))
|
||||
)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (calcAroundRefPt)
|
||||
{
|
||||
Info << "Inertia tensor relative to " << refPt << " = "
|
||||
Info << "Inertia tensor relative to " << refPt << ": "
|
||||
<< applyParallelAxisTheorem(m, cM, J, refPt)
|
||||
<< endl;
|
||||
}
|
||||
|
@ -676,6 +676,10 @@ Foam::Time& Foam::Time::operator++()
|
||||
|
||||
deltaT0_ = deltaTSave_;
|
||||
deltaTSave_ = deltaT_;
|
||||
|
||||
// Save old time name
|
||||
const word oldTimeName = dimensionedScalar::name();
|
||||
|
||||
setTime(value() + deltaT_, timeIndex_ + 1);
|
||||
|
||||
if (!subCycling_)
|
||||
@ -685,7 +689,30 @@ Foam::Time& Foam::Time::operator++()
|
||||
{
|
||||
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_)
|
||||
{
|
||||
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
|
||||
globalPointNumberingPtr_.reset
|
||||
globalIndicesPtr.reset
|
||||
(
|
||||
new globalIndex(globalData.globalIndices())
|
||||
);
|
||||
const globalIndex& globalIndices = globalPointNumberingPtr_();
|
||||
const globalIndex& globalIndices = globalIndicesPtr();
|
||||
|
||||
// Create master to slave addressing. Empty for slave points.
|
||||
globalPointSlavesPtr_.reset
|
||||
globalPointSlavesPtr.reset
|
||||
(
|
||||
new labelListList(coupledPatch().nPoints())
|
||||
);
|
||||
labelListList& globalPointSlaves = globalPointSlavesPtr_();
|
||||
labelListList& globalPointSlaves = globalPointSlavesPtr();
|
||||
|
||||
|
||||
const Map<label>& meshToProcPoint = globalData.meshToProcPoint();
|
||||
|
||||
forAllConstIter(Map<label>, meshToProcPoint, iter)
|
||||
{
|
||||
@ -465,7 +462,7 @@ void Foam::globalMeshData::calcGlobalPointSlaves() const
|
||||
// Changes globalPointSlaves to be indices into compact data
|
||||
|
||||
List<Map<label> > compactMap(Pstream::nProcs());
|
||||
globalPointSlavesMapPtr_.reset
|
||||
globalPointSlavesMapPtr.reset
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
@ -477,41 +474,50 @@ void Foam::globalMeshData::calcGlobalPointSlaves() const
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalPointSlaves() :"
|
||||
Pout<< "globalMeshData::calcGlobalPointSlaves(..) :"
|
||||
<< " coupled points:" << coupledPatch().nPoints()
|
||||
<< " additional remote points:"
|
||||
<< globalPointSlavesMapPtr_().constructSize()
|
||||
<< globalPointSlavesMapPtr().constructSize()
|
||||
- coupledPatch().nPoints()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
void Foam::globalMeshData::calcGlobalPointSlaves() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
||||
<< " calculating coupled master to slave edge addressing."
|
||||
Pout<< "globalMeshData::calcGlobalPointSlaves() :"
|
||||
<< " calculating coupled master to collocated"
|
||||
<< " slave point addressing."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
const labelListList& globalPointSlaves = this->globalPointSlaves();
|
||||
const mapDistribute& globalPointSlavesMap = this->globalPointSlavesMap();
|
||||
// Calculate collocated connected points for master points.
|
||||
globalPoints collocatedGlobalData(mesh_, coupledPatch(), true, false);
|
||||
|
||||
// - 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
|
||||
globalEdgeNumberingPtr_.reset
|
||||
calcGlobalPointSlaves
|
||||
(
|
||||
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.
|
||||
labelListList globalPointEdges(globalPointSlavesMap.constructSize());
|
||||
labelListList globalPointEdges(pointSlavesMap.constructSize());
|
||||
|
||||
// Create local version
|
||||
const labelListList& pointEdges = coupledPatch().pointEdges();
|
||||
@ -522,12 +528,12 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
globalPEdges.setSize(pEdges.size());
|
||||
forAll(pEdges, i)
|
||||
{
|
||||
globalPEdges[i] = globalIndices.toGlobal(pEdges[i]);
|
||||
globalPEdges[i] = globalEdgeIndices.toGlobal(pEdges[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Pull slave data to master
|
||||
globalPointSlavesMap.distribute(globalPointEdges);
|
||||
pointSlavesMap.distribute(globalPointEdges);
|
||||
|
||||
// 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
|
||||
@ -538,14 +544,14 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
const edgeList& edges = coupledPatch().edges();
|
||||
|
||||
// Create master to slave addressing. Empty for slave edges.
|
||||
globalEdgeSlavesPtr_.reset(new labelListList(edges.size()));
|
||||
labelListList& globalEdgeSlaves = globalEdgeSlavesPtr_();
|
||||
globalEdgeSlavesPtr.reset(new labelListList(edges.size()));
|
||||
labelListList& globalEdgeSlaves = globalEdgeSlavesPtr();
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
const labelList& slaves0 = globalPointSlaves[e[0]];
|
||||
const labelList& slaves1 = globalPointSlaves[e[1]];
|
||||
const labelList& slaves0 = pointSlaves[e[0]];
|
||||
const labelList& slaves1 = pointSlaves[e[1]];
|
||||
|
||||
// Check for edges that are in both slaves0 and slaves1.
|
||||
pointEdgeSet.clear();
|
||||
@ -576,11 +582,11 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
|
||||
// Construct map
|
||||
List<Map<label> > compactMap(Pstream::nProcs());
|
||||
globalEdgeSlavesMapPtr_.reset
|
||||
globalEdgeSlavesMapPtr.reset
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalIndices,
|
||||
globalEdgeIndices,
|
||||
globalEdgeSlaves,
|
||||
compactMap
|
||||
)
|
||||
@ -591,12 +597,39 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
||||
<< " coupled edge:" << edges.size()
|
||||
<< " additional remote edges:"
|
||||
<< globalEdgeSlavesMapPtr_().constructSize() - edges.size()
|
||||
<< globalEdgeSlavesMapPtr().constructSize() - edges.size()
|
||||
<< 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
|
||||
// primitiveMesh::pointFaces())
|
||||
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 * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from polyMesh
|
||||
@ -1057,6 +1139,17 @@ void Foam::globalMeshData::clearOut()
|
||||
globalBoundaryCellNumberingPtr_.clear();
|
||||
globalPointBoundaryCellsPtr_.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;
|
||||
pointField mergedPoints;
|
||||
|
||||
mergePoints
|
||||
Foam::mergePoints
|
||||
(
|
||||
sharedPoints, // coordinates to merge
|
||||
tolDim, // tolerance
|
||||
@ -1350,7 +1443,10 @@ const Foam::globalIndex& Foam::globalMeshData::globalEdgeNumbering() const
|
||||
{
|
||||
if (!globalEdgeNumberingPtr_.valid())
|
||||
{
|
||||
calcGlobalEdgeSlaves();
|
||||
globalEdgeNumberingPtr_.reset
|
||||
(
|
||||
new globalIndex(coupledPatch().nEdges())
|
||||
);
|
||||
}
|
||||
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)
|
||||
{
|
||||
// Topology does not change and we don't store any geometry so nothing
|
||||
@ -1482,8 +1865,9 @@ void Foam::globalMeshData::updateMesh()
|
||||
|
||||
// Option 1. Topological
|
||||
{
|
||||
// Calculate all shared points. This does all the hard work.
|
||||
globalPoints parallelPoints(mesh_, false);
|
||||
// Calculate all shared points (excluded points that are only
|
||||
// on two coupled patches). This does all the hard work.
|
||||
globalPoints parallelPoints(mesh_, false, true);
|
||||
|
||||
// Copy data out.
|
||||
nGlobalPoints_ = parallelPoints.nGlobalPoints();
|
||||
@ -1505,6 +1889,16 @@ void Foam::globalMeshData::updateMesh()
|
||||
// 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
|
||||
// processor faces (on highest numbered processor) before summing.
|
||||
nTotalFaces_ = mesh_.nFaces();
|
||||
|
@ -31,7 +31,7 @@ Description
|
||||
|
||||
Requires:
|
||||
- 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 vertices that cannot be set using a normal swap on processor patches.
|
||||
@ -67,14 +67,12 @@ Description
|
||||
|
||||
SourceFiles
|
||||
globalMeshData.C
|
||||
globalMeshDataMorph.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef globalMeshData_H
|
||||
#define globalMeshData_H
|
||||
|
||||
//#include "polyMesh.H"
|
||||
#include "Switch.H"
|
||||
#include "processorTopology.H"
|
||||
#include "labelPair.H"
|
||||
@ -95,6 +93,7 @@ class globalIndex;
|
||||
class polyMesh;
|
||||
class mapDistribute;
|
||||
template<class T> class EdgeMap;
|
||||
class globalPoints;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class globalMeshData Declaration
|
||||
@ -201,31 +200,36 @@ class globalMeshData
|
||||
|
||||
|
||||
// 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
|
||||
// coupled patches.
|
||||
|
||||
mutable autoPtr<indirectPrimitivePatch> coupledPatchPtr_;
|
||||
|
||||
// Coupled point to coupled points
|
||||
// Collocated
|
||||
|
||||
// Coupled point to collocated coupled points
|
||||
|
||||
mutable autoPtr<globalIndex> globalPointNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointSlavesMapPtr_;
|
||||
|
||||
// Coupled edge to coupled edges
|
||||
// Coupled edge to collocated coupled edges
|
||||
|
||||
mutable autoPtr<globalIndex> globalEdgeNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalEdgeSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalEdgeSlavesMapPtr_;
|
||||
|
||||
// Coupled point to boundary faces
|
||||
// Coupled point to collocated boundary faces
|
||||
|
||||
mutable autoPtr<globalIndex> globalBoundaryFaceNumberingPtr_;
|
||||
mutable autoPtr<labelListList> globalPointBoundaryFacesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
||||
|
||||
// Coupled point to boundary cells
|
||||
// Coupled point to collocated boundary cells
|
||||
|
||||
mutable autoPtr<labelList> boundaryCellsPtr_;
|
||||
mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
||||
@ -233,6 +237,21 @@ class globalMeshData
|
||||
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
|
||||
|
||||
//- Set up processor patch addressing
|
||||
@ -256,9 +275,28 @@ class globalMeshData
|
||||
const vectorField& separationDist
|
||||
);
|
||||
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointSlaves
|
||||
(
|
||||
const globalPoints&,
|
||||
autoPtr<globalIndex>&,
|
||||
autoPtr<labelListList>&,
|
||||
autoPtr<mapDistribute>&
|
||||
) const;
|
||||
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointSlaves() const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves
|
||||
(
|
||||
const labelListList&,
|
||||
const mapDistribute&,
|
||||
const globalIndex&,
|
||||
autoPtr<labelListList>&,
|
||||
autoPtr<mapDistribute>&
|
||||
) const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves() const;
|
||||
|
||||
@ -272,6 +310,15 @@ class globalMeshData
|
||||
void calcGlobalPointBoundaryCells() const;
|
||||
|
||||
|
||||
// Non-collocated
|
||||
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointAllSlaves() const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeAllSlaves() const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
globalMeshData(const globalMeshData&);
|
||||
|
||||
@ -449,8 +496,8 @@ public:
|
||||
//- Return patch of all coupled faces
|
||||
const indirectPrimitivePatch& coupledPatch() const;
|
||||
|
||||
// Coupled point to coupled points. Coupled points are points on
|
||||
// any coupled patch.
|
||||
// Coupled point to collocated coupled points. Coupled points are
|
||||
// points on any coupled patch.
|
||||
|
||||
//- Numbering of coupled points is according to coupledPatch.
|
||||
const globalIndex& globalPointNumbering() const;
|
||||
@ -484,6 +531,45 @@ public:
|
||||
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
|
||||
|
||||
//- 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
|
||||
points on processor patches. Now
|
||||
|
||||
- remove point equivalences of size 2. These are just normal points
|
||||
shared between two neighbouring procPatches.
|
||||
- (optional)remove point equivalences of size 2. These are
|
||||
just normal points shared between two neighbouring procPatches.
|
||||
- collect on each processor points for which it is the master
|
||||
- request number of sharedPointLabels from the Pstream::master.
|
||||
|
||||
@ -98,10 +98,10 @@ SourceFiles
|
||||
#include "DynamicList.H"
|
||||
#include "Map.H"
|
||||
#include "primitivePatch.H"
|
||||
#include "className.H"
|
||||
#include "edgeList.H"
|
||||
#include "globalIndex.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
#include "PackedBoolList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -112,6 +112,8 @@ namespace Foam
|
||||
class polyMesh;
|
||||
class polyBoundaryMesh;
|
||||
class cyclicPolyPatch;
|
||||
class polyPatch;
|
||||
class coupledPolyPatch;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class globalPoints Declaration
|
||||
@ -119,7 +121,15 @@ class cyclicPolyPatch;
|
||||
|
||||
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
|
||||
|
||||
@ -152,13 +162,53 @@ class globalPoints
|
||||
|
||||
// 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
|
||||
// information is collected.
|
||||
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
|
||||
// buffers (patchFaces, indexInFace etc.)
|
||||
static void addToSend
|
||||
@ -197,9 +247,17 @@ class globalPoints
|
||||
bool storeInfo
|
||||
(
|
||||
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:
|
||||
// seed with all patch points, = false: only boundaryPoints().
|
||||
void initOwnPoints
|
||||
@ -212,6 +270,7 @@ class globalPoints
|
||||
//- Send subset of procPoints to neighbours
|
||||
void sendPatchPoints
|
||||
(
|
||||
const bool mergeSeparated,
|
||||
const Map<label>&,
|
||||
PstreamBuffers&,
|
||||
const labelHashSet&
|
||||
@ -220,6 +279,7 @@ class globalPoints
|
||||
//- Receive neighbour points and merge into my procPoints.
|
||||
void receivePatchPoints
|
||||
(
|
||||
const bool mergeSeparated,
|
||||
const Map<label>&,
|
||||
PstreamBuffers&,
|
||||
labelHashSet&
|
||||
@ -230,20 +290,31 @@ class globalPoints
|
||||
void remove(const labelList& patchToMeshPoint, const Map<label>&);
|
||||
|
||||
//- 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)
|
||||
labelList getMasterPoints(const labelList& patchToMeshPoint) const;
|
||||
|
||||
|
||||
//- 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.
|
||||
void receiveSharedPoints
|
||||
(
|
||||
const Map<label>&,
|
||||
const bool mergeSeparated,
|
||||
const Map<label>& meshToPatchPoint,
|
||||
const Map<label>& meshToShared,
|
||||
PstreamBuffers&,
|
||||
labelList&
|
||||
DynamicList<label>&
|
||||
);
|
||||
|
||||
//- Should move into cyclicPolyPatch ordering problem
|
||||
@ -255,7 +326,8 @@ class globalPoints
|
||||
(
|
||||
const Map<label>&,
|
||||
const labelList&,
|
||||
const bool keepAllPoints
|
||||
const bool keepAllPoints,
|
||||
const bool mergeSeparated
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -276,7 +348,15 @@ public:
|
||||
//- Construct from mesh.
|
||||
// keepAllPoints = false : filter out points that are on two
|
||||
// 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 only is that this stores the meshToProcPoint,
|
||||
@ -286,7 +366,8 @@ public:
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
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)
|
||||
{
|
||||
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
|
||||
(
|
||||
"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 * * * * * * * * * * * * * * * //
|
||||
|
@ -114,6 +114,32 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
|
||||
|
||||
// * * * * * * * * * * * * * * * 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()
|
||||
{
|
||||
if (this->updated())
|
||||
@ -160,26 +186,6 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
||||
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_);
|
||||
|
||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||
|
@ -135,6 +135,22 @@ public:
|
||||
|
||||
// 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
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
|
@ -30,10 +30,20 @@ License
|
||||
|
||||
void Foam::sixDoFRigidBodyMotion::applyRestraints()
|
||||
{
|
||||
if (restraints_.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
forAll(restraints_, rI)
|
||||
{
|
||||
if (report_)
|
||||
{
|
||||
Info<< "Restraint " << restraintNames_[rI];
|
||||
}
|
||||
|
||||
// restraint position
|
||||
point rP = vector::zero;
|
||||
|
||||
@ -57,9 +67,14 @@ void Foam::sixDoFRigidBodyMotion::applyRestraints()
|
||||
|
||||
void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
||||
{
|
||||
if (constraints_.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
label iter = 0;
|
||||
label iteration = 0;
|
||||
|
||||
bool allConverged = true;
|
||||
|
||||
@ -75,6 +90,11 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
||||
|
||||
forAll(constraints_, cI)
|
||||
{
|
||||
if (report_)
|
||||
{
|
||||
Info<< "Constraint " << constraintNames_[cI];
|
||||
}
|
||||
|
||||
// constraint position
|
||||
point cP = vector::zero;
|
||||
|
||||
@ -104,9 +124,9 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
||||
cMA += cM + ((cP - centreOfMass()) ^ cF);
|
||||
}
|
||||
|
||||
} while(++iter < maxConstraintIters_ && !allConverged);
|
||||
} while(++iteration < maxConstraintIterations_ && !allConverged);
|
||||
|
||||
if (iter >= maxConstraintIters_)
|
||||
if (iteration >= maxConstraintIterations_)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
@ -114,13 +134,15 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
||||
"(scalar deltaT)"
|
||||
)
|
||||
<< nl << "Maximum number of sixDoFRigidBodyMotion constraint "
|
||||
<< "iterations (" << maxConstraintIters_ << ") exceeded." << nl
|
||||
<< "iterations ("
|
||||
<< maxConstraintIterations_
|
||||
<< ") exceeded." << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else if (report_)
|
||||
{
|
||||
Info<< "sixDoFRigidBodyMotion constraints converged in "
|
||||
<< iter << " iterations"
|
||||
<< iteration << " iterations"
|
||||
<< nl << "Constraint force: " << cFA << nl
|
||||
<< "Constraint moment: " << cMA
|
||||
<< endl;
|
||||
@ -143,8 +165,10 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
|
||||
:
|
||||
motionState_(),
|
||||
restraints_(),
|
||||
restraintNames_(),
|
||||
constraints_(),
|
||||
maxConstraintIters_(0),
|
||||
constraintNames_(),
|
||||
maxConstraintIterations_(0),
|
||||
refCentreOfMass_(vector::zero),
|
||||
momentOfInertia_(diagTensor::one*VSMALL),
|
||||
mass_(VSMALL),
|
||||
@ -176,8 +200,10 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
||||
tau
|
||||
),
|
||||
restraints_(),
|
||||
restraintNames_(),
|
||||
constraints_(),
|
||||
maxConstraintIters_(0),
|
||||
constraintNames_(),
|
||||
maxConstraintIterations_(0),
|
||||
refCentreOfMass_(refCentreOfMass),
|
||||
momentOfInertia_(momentOfInertia),
|
||||
mass_(mass),
|
||||
@ -189,8 +215,10 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
|
||||
:
|
||||
motionState_(dict),
|
||||
restraints_(),
|
||||
restraintNames_(),
|
||||
constraints_(),
|
||||
maxConstraintIters_(0),
|
||||
constraintNames_(),
|
||||
maxConstraintIterations_(0),
|
||||
refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())),
|
||||
momentOfInertia_(dict.lookup("momentOfInertia")),
|
||||
mass_(readScalar(dict.lookup("mass"))),
|
||||
@ -209,8 +237,10 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
|
||||
:
|
||||
motionState_(sDoFRBM.motionState()),
|
||||
restraints_(sDoFRBM.restraints()),
|
||||
restraintNames_(sDoFRBM.restraintNames()),
|
||||
constraints_(sDoFRBM.constraints()),
|
||||
maxConstraintIters_(sDoFRBM.maxConstraintIters()),
|
||||
constraintNames_(sDoFRBM.constraintNames()),
|
||||
maxConstraintIterations_(sDoFRBM.maxConstraintIterations()),
|
||||
refCentreOfMass_(sDoFRBM.refCentreOfMass()),
|
||||
momentOfInertia_(sDoFRBM.momentOfInertia()),
|
||||
mass_(sDoFRBM.mass()),
|
||||
@ -239,23 +269,29 @@ void Foam::sixDoFRigidBodyMotion::addRestraints
|
||||
|
||||
restraints_.setSize(restraintDict.size());
|
||||
|
||||
restraintNames_.setSize(restraintDict.size());
|
||||
|
||||
forAllConstIter(IDLList<entry>, restraintDict, iter)
|
||||
{
|
||||
if (iter().isDict())
|
||||
{
|
||||
Info<< "Adding restraint: " << iter().keyword() << endl;
|
||||
// Info<< "Adding restraint: " << iter().keyword() << endl;
|
||||
|
||||
restraints_.set
|
||||
(
|
||||
i,
|
||||
sixDoFRigidBodyMotionRestraint::New(iter().dict())
|
||||
);
|
||||
}
|
||||
|
||||
i++;
|
||||
restraintNames_[i] = iter().keyword();
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
restraints_.setSize(i);
|
||||
|
||||
restraintNames_.setSize(i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,25 +309,33 @@ void Foam::sixDoFRigidBodyMotion::addConstraints
|
||||
|
||||
constraints_.setSize(constraintDict.size());
|
||||
|
||||
constraintNames_.setSize(constraintDict.size());
|
||||
|
||||
forAllConstIter(IDLList<entry>, constraintDict, iter)
|
||||
{
|
||||
if (iter().isDict())
|
||||
{
|
||||
Info<< "Adding constraint: " << iter().keyword() << endl;
|
||||
// Info<< "Adding constraint: " << iter().keyword() << endl;
|
||||
|
||||
constraints_.set
|
||||
(
|
||||
i++,
|
||||
i,
|
||||
sixDoFRigidBodyMotionConstraint::New(iter().dict())
|
||||
);
|
||||
|
||||
constraintNames_[i] = iter().keyword();
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
constraints_.setSize(i);
|
||||
|
||||
if (constraints_.size())
|
||||
constraintNames_.setSize(i);
|
||||
|
||||
if (!constraints_.empty())
|
||||
{
|
||||
maxConstraintIters_ = readLabel
|
||||
maxConstraintIterations_ = readLabel
|
||||
(
|
||||
constraintDict.lookup("maxIterations")
|
||||
);
|
||||
|
@ -91,12 +91,18 @@ class sixDoFRigidBodyMotion
|
||||
//- Restraints on the motion
|
||||
PtrList<sixDoFRigidBodyMotionRestraint> restraints_;
|
||||
|
||||
//- Names of the restraints
|
||||
wordList restraintNames_;
|
||||
|
||||
//- Constaints on the motion
|
||||
PtrList<sixDoFRigidBodyMotionConstraint> constraints_;
|
||||
|
||||
//- Names of the constraints
|
||||
wordList constraintNames_;
|
||||
|
||||
//- Maximum number of iterations allowed to attempt to obey
|
||||
// constraints
|
||||
label maxConstraintIters_;
|
||||
label maxConstraintIterations_;
|
||||
|
||||
//- Centre of mass of reference state
|
||||
point refCentreOfMass_;
|
||||
@ -146,13 +152,19 @@ class sixDoFRigidBodyMotion
|
||||
inline const PtrList<sixDoFRigidBodyMotionRestraint>&
|
||||
restraints() const;
|
||||
|
||||
//- Return access to the restraintNames
|
||||
inline const wordList& restraintNames() const;
|
||||
|
||||
//- Return access to the constraints
|
||||
inline const PtrList<sixDoFRigidBodyMotionConstraint>&
|
||||
constraints() const;
|
||||
|
||||
//- Return access to the constraintNames
|
||||
inline const wordList& constraintNames() const;
|
||||
|
||||
//- Return access to the maximum allowed number of
|
||||
// constraint iterations
|
||||
inline label maxConstraintIters() const;
|
||||
inline label maxConstraintIterations() const;
|
||||
|
||||
//- Return access to the centre of mass
|
||||
inline const point& refCentreOfMass() const;
|
||||
|
@ -123,8 +123,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::constrain
|
||||
|
||||
if (motion.report())
|
||||
{
|
||||
Info<< "Constraint " << this->name()
|
||||
<< " angle " << theta
|
||||
Info<< " angle " << theta
|
||||
<< " force " << constraintForceIncrement
|
||||
<< " moment " << constraintMomentIncrement;
|
||||
|
||||
@ -175,4 +174,14 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -109,8 +109,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedLine::constrain
|
||||
|
||||
if (motion.report())
|
||||
{
|
||||
Info<< "Constraint " << this->name()
|
||||
<< " error << " << error
|
||||
Info<< " error " << error
|
||||
<< " force " << constraintForceIncrement
|
||||
<< " moment " << constraintMomentIncrement;
|
||||
|
||||
@ -163,4 +162,17 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedLine::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -150,8 +150,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedOrientation::constrain
|
||||
|
||||
if (motion.report())
|
||||
{
|
||||
Info<< "Constraint " << this->name()
|
||||
<< " max angle " << maxTheta
|
||||
Info<< " max angle " << maxTheta
|
||||
<< " force " << constraintForceIncrement
|
||||
<< " moment " << constraintMomentIncrement;
|
||||
|
||||
@ -198,4 +197,14 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedOrientation::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -109,8 +109,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedPlane::constrain
|
||||
|
||||
if (motion.report())
|
||||
{
|
||||
Info<< "Constraint " << this->name()
|
||||
<< " error " << error
|
||||
Info<< " error " << error
|
||||
<< " force " << constraintForceIncrement
|
||||
<< " moment " << constraintMomentIncrement;
|
||||
|
||||
@ -146,4 +145,17 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedPlane::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -118,8 +118,7 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::constrain
|
||||
|
||||
if (motion.report())
|
||||
{
|
||||
Info<< "Constraint " << this->name()
|
||||
<< " error " << error
|
||||
Info<< " error " << error
|
||||
<< " force " << constraintForceIncrement
|
||||
<< " moment " << constraintMomentIncrement;
|
||||
|
||||
@ -151,4 +150,14 @@ bool Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMCCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,8 +34,8 @@ Foam::sixDoFRigidBodyMotionConstraint::New(const dictionary& sDoFRBMCDict)
|
||||
word sixDoFRigidBodyMotionConstraintTypeName =
|
||||
sDoFRBMCDict.lookup("sixDoFRigidBodyMotionConstraint");
|
||||
|
||||
Info<< "Selecting sixDoFRigidBodyMotionConstraint function "
|
||||
<< sixDoFRigidBodyMotionConstraintTypeName << endl;
|
||||
// Info<< "Selecting sixDoFRigidBodyMotionConstraint function "
|
||||
// << sixDoFRigidBodyMotionConstraintTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find
|
||||
|
@ -39,7 +39,6 @@ Foam::sixDoFRigidBodyMotionConstraint::sixDoFRigidBodyMotionConstraint
|
||||
const dictionary& sDoFRBMCDict
|
||||
)
|
||||
:
|
||||
name_(fileName(sDoFRBMCDict.name().name()).components(token::COLON).last()),
|
||||
sDoFRBMCCoeffs_
|
||||
(
|
||||
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
|
||||
|
||||
//- Name of the constraint in dictionary
|
||||
word name_;
|
||||
|
||||
//- Constraint model specific coefficient dictionary
|
||||
dictionary sDoFRBMCCoeffs_;
|
||||
|
||||
@ -145,16 +142,10 @@ public:
|
||||
) const = 0;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& sDoFRBMCDict) = 0;
|
||||
virtual bool read(const dictionary& sDoFRBMCDict);
|
||||
|
||||
// Access
|
||||
|
||||
//- Return access to the name of the restraint
|
||||
inline const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
// Return access to sDoFRBMCCoeffs
|
||||
inline const dictionary& coeffDict() const
|
||||
{
|
||||
@ -172,6 +163,9 @@ public:
|
||||
{
|
||||
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>&
|
||||
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")
|
||||
<< 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)
|
||||
{
|
||||
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
|
||||
(
|
||||
word(restraintType + "Coeffs"), restraints_[rI].coeffDict()
|
||||
);
|
||||
os.writeKeyword(word(restraintType + "Coeffs")) << nl;
|
||||
|
||||
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)
|
||||
{
|
||||
word constraintType = constraints_[rI].type();
|
||||
|
||||
dictionary constraintDict;
|
||||
os << indent << constraintNames_[rI] << nl
|
||||
<< indent << token::BEGIN_BLOCK << incrIndent << endl;
|
||||
|
||||
constraintDict.add
|
||||
(
|
||||
"sixDoFRigidBodyMotionConstraint",
|
||||
constraintType
|
||||
);
|
||||
os.writeKeyword("sixDoFRigidBodyMotionConstraint")
|
||||
<< constraintType << token::END_STATEMENT << nl;
|
||||
|
||||
constraintDict.add
|
||||
(
|
||||
"tolerance",
|
||||
constraints_[rI].tolerance()
|
||||
);
|
||||
constraints_[rI].sixDoFRigidBodyMotionConstraint::write(os);
|
||||
|
||||
constraintDict.add
|
||||
(
|
||||
"relaxationFactor",
|
||||
constraints_[rI].relaxationFactor()
|
||||
);
|
||||
os.writeKeyword(word(constraintType + "Coeffs")) << nl;
|
||||
|
||||
constraintDict.add
|
||||
(
|
||||
word(constraintType + "Coeffs"), constraints_[rI].coeffDict()
|
||||
);
|
||||
os << indent << token::BEGIN_BLOCK << nl << incrIndent;
|
||||
|
||||
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())
|
||||
{
|
||||
Info<< "Restraint " << this->name()
|
||||
<< " angle " << theta
|
||||
Info<< " angle " << theta
|
||||
<< " force " << restraintForce
|
||||
<< " moment " << restraintMoment
|
||||
<< endl;
|
||||
@ -199,4 +198,23 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearAxialAngularSpring::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -96,8 +96,7 @@ void Foam::sixDoFRigidBodyMotionRestraints::linearSpring::restrain
|
||||
|
||||
if (motion.report())
|
||||
{
|
||||
Info<< "Restraint " << this->name()
|
||||
<< " spring length " << magR
|
||||
Info<< " spring length " << magR
|
||||
<< " force " << restraintForce
|
||||
<< " moment " << restraintMoment
|
||||
<< endl;
|
||||
@ -125,4 +124,26 @@ bool Foam::sixDoFRigidBodyMotionRestraints::linearSpring::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,8 +34,8 @@ Foam::sixDoFRigidBodyMotionRestraint::New(const dictionary& sDoFRBMRDict)
|
||||
word sixDoFRigidBodyMotionRestraintTypeName =
|
||||
sDoFRBMRDict.lookup("sixDoFRigidBodyMotionRestraint");
|
||||
|
||||
Info<< "Selecting sixDoFRigidBodyMotionRestraint function "
|
||||
<< sixDoFRigidBodyMotionRestraintTypeName << endl;
|
||||
// Info<< "Selecting sixDoFRigidBodyMotionRestraint function "
|
||||
// << sixDoFRigidBodyMotionRestraintTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
/*---------------------------------------------------------------------------* \
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
@ -39,7 +39,6 @@ Foam::sixDoFRigidBodyMotionRestraint::sixDoFRigidBodyMotionRestraint
|
||||
const dictionary& sDoFRBMRDict
|
||||
)
|
||||
:
|
||||
name_(fileName(sDoFRBMRDict.name().name()).components(token::COLON).last()),
|
||||
sDoFRBMRCoeffs_
|
||||
(
|
||||
sDoFRBMRDict.subDict
|
||||
|
@ -70,9 +70,6 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of the constraint in dictionary
|
||||
word name_;
|
||||
|
||||
//- Restraint model specific coefficient dictionary
|
||||
dictionary sDoFRBMRCoeffs_;
|
||||
|
||||
@ -134,21 +131,18 @@ public:
|
||||
) const = 0;
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& sDoFRBMRDict) = 0;
|
||||
virtual bool read(const dictionary& sDoFRBMRDict);
|
||||
|
||||
// Access
|
||||
|
||||
//- Return access to the name of the restraint
|
||||
inline const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
// Return access to sDoFRBMRCoeffs
|
||||
inline const dictionary& coeffDict() const
|
||||
{
|
||||
return sDoFRBMRCoeffs_;
|
||||
}
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -113,8 +113,7 @@ Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::restrain
|
||||
|
||||
if (motion.report())
|
||||
{
|
||||
Info<< "Restraint " << this->name()
|
||||
<< " force " << restraintForce
|
||||
Info<< " force " << restraintForce
|
||||
<< " moment " << restraintMoment
|
||||
<< endl;
|
||||
}
|
||||
@ -153,4 +152,19 @@ bool Foam::sixDoFRigidBodyMotionRestraints::sphericalAngularSpring::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -136,8 +136,7 @@ Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::restrain
|
||||
|
||||
if (motion.report())
|
||||
{
|
||||
Info<< "Restraint " << this->name()
|
||||
<< " angle " << theta
|
||||
Info<< " angle " << theta
|
||||
<< " force " << restraintForce
|
||||
<< " moment " << restraintMoment
|
||||
<< endl;
|
||||
@ -223,4 +222,34 @@ bool Foam::sixDoFRigidBodyMotionRestraints::tabulatedAxialAngularSpring::read
|
||||
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
|
||||
virtual bool read(const dictionary& sDoFRBMRCoeff);
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ boundaryField
|
||||
{
|
||||
type sixDoFRigidBodyDisplacement;
|
||||
centreOfMass (0.5 0.5 0.5);
|
||||
momentOfInertia (0.08622222 0.8622222 0.144);
|
||||
momentOfInertia (0.08622222 0.08622222 0.144);
|
||||
mass 9.6;
|
||||
rhoInf 1; // for forces calculation
|
||||
// See sixDoFRigidBodyMotionState
|
||||
|
Loading…
Reference in New Issue
Block a user