mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added write patch geometry to externalCoupled BC
This commit is contained in:
@ -30,6 +30,7 @@ License
|
||||
#include "IFstream.H"
|
||||
#include "OFstream.H"
|
||||
#include "globalIndex.H"
|
||||
#include "ListListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -52,6 +53,62 @@ Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::baseDir() const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::externalCoupledMixedFvPatchField<Type>::writeGeometry() const
|
||||
{
|
||||
int tag = Pstream::msgType() + 1;
|
||||
|
||||
const label procI = Pstream::myProcNo();
|
||||
const polyPatch& p = this->patch().patch();
|
||||
const polyMesh& mesh = p.boundaryMesh().mesh();
|
||||
|
||||
labelList pointToGlobal;
|
||||
labelList uniquePointIDs;
|
||||
(void)mesh.globalData().mergePoints
|
||||
(
|
||||
p.meshPoints(),
|
||||
p.meshPointMap(),
|
||||
pointToGlobal,
|
||||
uniquePointIDs
|
||||
);
|
||||
|
||||
List<pointField> allPoints(Pstream::nProcs());
|
||||
allPoints[procI] = pointField(mesh.points(), uniquePointIDs);
|
||||
Pstream::gatherList(allPoints, tag);
|
||||
|
||||
List<faceList> allFaces(Pstream::nProcs());
|
||||
faceList& patchFaces = allFaces[procI];
|
||||
patchFaces = p.localFaces();
|
||||
forAll(patchFaces, faceI)
|
||||
{
|
||||
inplaceRenumber(pointToGlobal, patchFaces[faceI]);
|
||||
}
|
||||
|
||||
Pstream::gatherList(allFaces, tag);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
OFstream osPoints(baseDir()/"patchPoints");
|
||||
if (log_)
|
||||
{
|
||||
Info<< "writing patch points to: " << osPoints.name() << endl;
|
||||
}
|
||||
|
||||
osPoints<<
|
||||
ListListOps::combine<pointField>(allPoints, accessOp<pointField>());
|
||||
|
||||
OFstream osFaces(baseDir()/"patchFaces");
|
||||
if (log_)
|
||||
{
|
||||
Info<< "writing patch faces to: " << osFaces.name() << endl;
|
||||
}
|
||||
|
||||
osFaces<<
|
||||
ListListOps::combine<faceList>(allFaces, accessOp<faceList>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::lockFile() const
|
||||
{
|
||||
@ -346,6 +403,8 @@ Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField
|
||||
this->refValue() = *this;
|
||||
this->refGrad() = pTraits<Type>::zero;
|
||||
this->valueFraction() = 1.0;
|
||||
|
||||
writeGeometry();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -137,6 +137,9 @@ protected:
|
||||
//- Return the file path to the base communications folder
|
||||
fileName baseDir() const;
|
||||
|
||||
//- Write the geometry to the comms dir
|
||||
void writeGeometry() const;
|
||||
|
||||
//- Return the file path to the lock file
|
||||
fileName lockFile() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user