mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: finite volume did not work before.
This commit is contained in:
@ -337,22 +337,22 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Construct the point fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
pointMesh pMesh(mesh);
|
||||
// pointMesh pMesh(mesh);
|
||||
|
||||
PtrList<pointScalarField> pointScalarFields;
|
||||
readFields(pMesh, objects, pointScalarFields);
|
||||
// readFields(pMesh, objects, pointScalarFields);
|
||||
|
||||
PtrList<pointVectorField> pointVectorFields;
|
||||
readFields(pMesh, objects, pointVectorFields);
|
||||
// readFields(pMesh, objects, pointVectorFields);
|
||||
|
||||
PtrList<pointSphericalTensorField> pointSphericalTensorFields;
|
||||
readFields(pMesh, objects, pointSphericalTensorFields);
|
||||
// readFields(pMesh, objects, pointSphericalTensorFields);
|
||||
|
||||
PtrList<pointSymmTensorField> pointSymmTensorFields;
|
||||
readFields(pMesh, objects, pointSymmTensorFields);
|
||||
// readFields(pMesh, objects, pointSymmTensorFields);
|
||||
|
||||
PtrList<pointTensorField> pointTensorFields;
|
||||
readFields(pMesh, objects, pointTensorFields);
|
||||
// readFields(pMesh, objects, pointTensorFields);
|
||||
|
||||
|
||||
// Construct the Lagrangian fields
|
||||
@ -652,45 +652,45 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// Point fields
|
||||
if
|
||||
(
|
||||
pointScalarFields.size()
|
||||
|| pointVectorFields.size()
|
||||
|| pointSphericalTensorFields.size()
|
||||
|| pointSymmTensorFields.size()
|
||||
|| pointTensorFields.size()
|
||||
)
|
||||
{
|
||||
labelIOList pointProcAddressing
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointProcAddressing",
|
||||
procMesh.facesInstance(),
|
||||
procMesh.meshSubDir,
|
||||
procMesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
pointMesh procPMesh(procMesh, true);
|
||||
|
||||
pointFieldDecomposer fieldDecomposer
|
||||
(
|
||||
pMesh,
|
||||
procPMesh,
|
||||
pointProcAddressing,
|
||||
boundaryProcAddressing
|
||||
);
|
||||
|
||||
fieldDecomposer.decomposeFields(pointScalarFields);
|
||||
fieldDecomposer.decomposeFields(pointVectorFields);
|
||||
fieldDecomposer.decomposeFields(pointSphericalTensorFields);
|
||||
fieldDecomposer.decomposeFields(pointSymmTensorFields);
|
||||
fieldDecomposer.decomposeFields(pointTensorFields);
|
||||
}
|
||||
// // Point fields
|
||||
// if
|
||||
// (
|
||||
// pointScalarFields.size()
|
||||
// || pointVectorFields.size()
|
||||
// || pointSphericalTensorFields.size()
|
||||
// || pointSymmTensorFields.size()
|
||||
// || pointTensorFields.size()
|
||||
// )
|
||||
// {
|
||||
// labelIOList pointProcAddressing
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "pointProcAddressing",
|
||||
// procMesh.facesInstance(),
|
||||
// procMesh.meshSubDir,
|
||||
// procMesh,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// pointMesh procPMesh(procMesh, true);
|
||||
//
|
||||
// pointFieldDecomposer fieldDecomposer
|
||||
// (
|
||||
// pMesh,
|
||||
// procPMesh,
|
||||
// pointProcAddressing,
|
||||
// boundaryProcAddressing
|
||||
// );
|
||||
//
|
||||
// fieldDecomposer.decomposeFields(pointScalarFields);
|
||||
// fieldDecomposer.decomposeFields(pointVectorFields);
|
||||
// fieldDecomposer.decomposeFields(pointSphericalTensorFields);
|
||||
// fieldDecomposer.decomposeFields(pointSymmTensorFields);
|
||||
// fieldDecomposer.decomposeFields(pointTensorFields);
|
||||
// }
|
||||
|
||||
|
||||
// If there is lagrangian data write it out
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "dictionary.H"
|
||||
#include "labelIOList.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "processorCyclicPolyPatch.H"
|
||||
#include "fvMesh.H"
|
||||
#include "OSspecific.H"
|
||||
#include "Map.H"
|
||||
@ -293,10 +294,34 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
|
||||
const polyPatchList& meshPatches = boundaryMesh();
|
||||
|
||||
|
||||
// Count the number of inter-proc patches
|
||||
label nInterProcPatches = 0;
|
||||
forAll(curSubPatchIDs, procPatchI)
|
||||
{
|
||||
Info<< "For processor " << procI
|
||||
<< " have to destination processor "
|
||||
<< curNeighbourProcessors[procPatchI] << endl;
|
||||
|
||||
forAll(curSubPatchIDs[procPatchI], i)
|
||||
{
|
||||
Info<< " from patch:" << curSubPatchIDs[procPatchI][i]
|
||||
<< " starting at:" << curSubStarts[procPatchI][i]
|
||||
<< endl;
|
||||
}
|
||||
|
||||
nInterProcPatches += curSubPatchIDs[procPatchI].size();
|
||||
}
|
||||
|
||||
Info<< "For processor " << procI
|
||||
<< " have " << nInterProcPatches << " to neighbouring processors"
|
||||
<< endl;
|
||||
|
||||
|
||||
List<polyPatch*> procPatches
|
||||
(
|
||||
curPatchSizes.size()
|
||||
+ curProcessorPatchSizes.size(),
|
||||
+ nInterProcPatches, //curProcessorPatchSizes.size(),
|
||||
reinterpret_cast<polyPatch*>(0)
|
||||
);
|
||||
|
||||
@ -335,23 +360,72 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
|
||||
forAll(curProcessorPatchSizes, procPatchI)
|
||||
{
|
||||
procPatches[nPatches] =
|
||||
new processorPolyPatch
|
||||
(
|
||||
word("procBoundary") + Foam::name(procI)
|
||||
+ word("to")
|
||||
+ Foam::name(curNeighbourProcessors[procPatchI]),
|
||||
curProcessorPatchSizes[procPatchI],
|
||||
curProcessorPatchStarts[procPatchI],
|
||||
nPatches,
|
||||
procMesh.boundaryMesh(),
|
||||
procI,
|
||||
curNeighbourProcessors[procPatchI],
|
||||
curSubPatchIDs[procPatchI],
|
||||
curSubStarts[procPatchI]
|
||||
);
|
||||
const labelList& subPatchID = curSubPatchIDs[procPatchI];
|
||||
const labelList& subStarts = curSubStarts[procPatchI];
|
||||
|
||||
nPatches++;
|
||||
label curStart = curProcessorPatchStarts[procPatchI];
|
||||
|
||||
forAll(subPatchID, i)
|
||||
{
|
||||
label size =
|
||||
(
|
||||
i < subPatchID.size()-1
|
||||
? subStarts[i+1] - subStarts[i]
|
||||
: curProcessorPatchSizes[procPatchI] - subStarts[i]
|
||||
);
|
||||
|
||||
Info<< "From processor:" << procI << endl
|
||||
<< " to processor:" << curNeighbourProcessors[procPatchI]
|
||||
<< endl
|
||||
<< " via patch:" << subPatchID[i] << endl
|
||||
<< " start :" << curStart << endl
|
||||
<< " size :" << size << endl;
|
||||
|
||||
if (subPatchID[i] == -1)
|
||||
{
|
||||
// From internal faces
|
||||
procPatches[nPatches] =
|
||||
new processorPolyPatch
|
||||
(
|
||||
word("procBoundary") + Foam::name(procI)
|
||||
+ "to"
|
||||
+ Foam::name(curNeighbourProcessors[procPatchI]),
|
||||
size,
|
||||
curStart,
|
||||
nPatches,
|
||||
procMesh.boundaryMesh(),
|
||||
procI,
|
||||
curNeighbourProcessors[procPatchI]
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// From cyclic
|
||||
const word& referPatch =
|
||||
boundaryMesh()[subPatchID[i]].name();
|
||||
|
||||
procPatches[nPatches] =
|
||||
new processorCyclicPolyPatch
|
||||
(
|
||||
word("procBoundary") + Foam::name(procI)
|
||||
+ "to"
|
||||
+ Foam::name(curNeighbourProcessors[procPatchI])
|
||||
+ "through"
|
||||
+ referPatch,
|
||||
size,
|
||||
curStart,
|
||||
nPatches,
|
||||
procMesh.boundaryMesh(),
|
||||
procI,
|
||||
curNeighbourProcessors[procPatchI],
|
||||
referPatch
|
||||
);
|
||||
}
|
||||
|
||||
curStart += size;
|
||||
|
||||
nPatches++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void domainDecomposition::append(labelList& lst, const label elem)
|
||||
void Foam::domainDecomposition::append(labelList& lst, const label elem)
|
||||
{
|
||||
label sz = lst.size();
|
||||
lst.setSize(sz+1);
|
||||
@ -48,7 +48,7 @@ void domainDecomposition::append(labelList& lst, const label elem)
|
||||
}
|
||||
|
||||
|
||||
void domainDecomposition::addInterProcFace
|
||||
void Foam::domainDecomposition::addInterProcFace
|
||||
(
|
||||
const label facei,
|
||||
const label ownerProc,
|
||||
@ -97,7 +97,7 @@ void domainDecomposition::addInterProcFace
|
||||
}
|
||||
|
||||
|
||||
void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
{
|
||||
// Decide which cell goes to which processor
|
||||
distributeCells();
|
||||
@ -230,14 +230,15 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
facei,
|
||||
ownerProc,
|
||||
nbrProc,
|
||||
|
||||
procNbrToInterPatch,
|
||||
interPatchFaces
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the proper processor faces to the sub information. Since faces
|
||||
// originate from internal faces this is always -1.
|
||||
// Add the proper processor faces to the sub information. For faces
|
||||
// originating from internal faces this is always -1.
|
||||
List<labelListList> subPatchIDs(nProcs_);
|
||||
List<labelListList> subPatchStarts(nProcs_);
|
||||
forAll(interPatchFaces, procI)
|
||||
@ -415,7 +416,16 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
forAll(procBoundaryAddressing_, procI)
|
||||
{
|
||||
label nNormal = procPatchSize_[procI].size();
|
||||
label nInterProc = procProcessorPatchSize_[procI].size();
|
||||
|
||||
const labelListList& curSubPatchIDs =
|
||||
procProcessorPatchSubPatchIDs_[procI];
|
||||
|
||||
// label nInterProc = procProcessorPatchSize_[procI].size();
|
||||
label nInterProc = 0;
|
||||
forAll(curSubPatchIDs, procPatchI)
|
||||
{
|
||||
nInterProc += curSubPatchIDs[procPatchI].size();
|
||||
}
|
||||
|
||||
procBoundaryAddressing_[procI].setSize(nNormal + nInterProc);
|
||||
|
||||
@ -423,9 +433,14 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
{
|
||||
procBoundaryAddressing_[procI][patchI] = patchI;
|
||||
}
|
||||
for (label patchI = nNormal; patchI < nNormal+nInterProc; patchI++)
|
||||
label patchI = nNormal;
|
||||
forAll(curSubPatchIDs, procPatchI)
|
||||
{
|
||||
procBoundaryAddressing_[procI][patchI] = -1;
|
||||
forAll(curSubPatchIDs[procPatchI], i)
|
||||
{
|
||||
procBoundaryAddressing_[procI][patchI++] =
|
||||
curSubPatchIDs[procPatchI][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -145,7 +145,11 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
|
||||
{
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
if (boundaryAddressing_[patchi] >= 0)
|
||||
if
|
||||
(
|
||||
boundaryAddressing_[patchi] >= 0
|
||||
&& !isA<processorLduInterface>(procMesh.boundary()[patchi])
|
||||
)
|
||||
{
|
||||
patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer
|
||||
(
|
||||
|
||||
@ -27,6 +27,8 @@ License
|
||||
#include "fvFieldDecomposer.H"
|
||||
#include "processorFvPatchField.H"
|
||||
#include "processorFvsPatchField.H"
|
||||
#include "processorCyclicFvPatchField.H"
|
||||
#include "processorCyclicFvsPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -45,7 +47,7 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
if (boundaryAddressing_[patchi] >= 0)
|
||||
if (patchFieldDecomposerPtrs_[patchi])
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
@ -59,7 +61,24 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi]))
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
patchi,
|
||||
new processorCyclicFvPatchField<Type>
|
||||
(
|
||||
procMesh_.boundary()[patchi],
|
||||
DimensionedField<Type, volMesh>::null(),
|
||||
Field<Type>
|
||||
(
|
||||
field.internalField(),
|
||||
*processorVolPatchFieldDecomposerPtrs_[patchi]
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (isA<processorFvPatch>(procMesh_.boundary()[patchi]))
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
@ -76,6 +95,11 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("fvFieldDecomposer::decomposeField()")
|
||||
<< "Unknown type." << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the field for the processor
|
||||
@ -156,7 +180,7 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
if (boundaryAddressing_[patchi] >= 0)
|
||||
if (patchFieldDecomposerPtrs_[patchi])
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
@ -170,7 +194,24 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi]))
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
patchi,
|
||||
new processorCyclicFvsPatchField<Type>
|
||||
(
|
||||
procMesh_.boundary()[patchi],
|
||||
DimensionedField<Type, surfaceMesh>::null(),
|
||||
Field<Type>
|
||||
(
|
||||
allFaceField,
|
||||
*processorSurfacePatchFieldDecomposerPtrs_[patchi]
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (isA<processorFvPatch>(procMesh_.boundary()[patchi]))
|
||||
{
|
||||
patchFields.set
|
||||
(
|
||||
@ -187,6 +228,11 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("fvFieldDecomposer::decomposeField()")
|
||||
<< "Unknown type." << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the field for the processor
|
||||
|
||||
Reference in New Issue
Block a user