diff --git a/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C index 5da9b8a19d..15e315b8de 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.C @@ -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::baseDir() const } +template +void Foam::externalCoupledMixedFvPatchField::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 allPoints(Pstream::nProcs()); + allPoints[procI] = pointField(mesh.points(), uniquePointIDs); + Pstream::gatherList(allPoints, tag); + + List 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(allPoints, accessOp()); + + OFstream osFaces(baseDir()/"patchFaces"); + if (log_) + { + Info<< "writing patch faces to: " << osFaces.name() << endl; + } + + osFaces<< + ListListOps::combine(allFaces, accessOp()); + } +} + + template Foam::fileName Foam::externalCoupledMixedFvPatchField::lockFile() const { @@ -346,6 +403,8 @@ Foam::externalCoupledMixedFvPatchField::externalCoupledMixedFvPatchField this->refValue() = *this; this->refGrad() = pTraits::zero; this->valueFraction() = 1.0; + + writeGeometry(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H index 50376e097d..a51ef9af7b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/externalCoupledMixed/externalCoupledMixedFvPatchField.H @@ -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;