Skip to content
Snippets Groups Projects
Commit d8d7a8a4 authored by andy's avatar andy
Browse files

ENH: Added write patch geometry to externalCoupled BC

parent 29b74534
Branches
Tags
No related merge requests found
...@@ -30,6 +30,7 @@ License ...@@ -30,6 +30,7 @@ License
#include "IFstream.H" #include "IFstream.H"
#include "OFstream.H" #include "OFstream.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...@@ -52,6 +53,62 @@ Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::baseDir() const ...@@ -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> template<class Type>
Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::lockFile() const Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::lockFile() const
{ {
...@@ -346,6 +403,8 @@ Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField ...@@ -346,6 +403,8 @@ Foam::externalCoupledMixedFvPatchField<Type>::externalCoupledMixedFvPatchField
this->refValue() = *this; this->refValue() = *this;
this->refGrad() = pTraits<Type>::zero; this->refGrad() = pTraits<Type>::zero;
this->valueFraction() = 1.0; this->valueFraction() = 1.0;
writeGeometry();
} }
......
...@@ -137,6 +137,9 @@ protected: ...@@ -137,6 +137,9 @@ protected:
//- Return the file path to the base communications folder //- Return the file path to the base communications folder
fileName baseDir() const; fileName baseDir() const;
//- Write the geometry to the comms dir
void writeGeometry() const;
//- Return the file path to the lock file //- Return the file path to the lock file
fileName lockFile() const; fileName lockFile() const;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment