BUG: finite volume did not work before.

This commit is contained in:
mattijs
2010-03-03 10:12:35 +00:00
parent 46ad2e55d6
commit 5ece14ec6f
108 changed files with 3119 additions and 2099 deletions

View File

@ -252,12 +252,13 @@ bool Foam::FaceCellWave<Type>::updateFace
template <class Type>
void Foam::FaceCellWave<Type>::checkCyclic(const polyPatch& patch) const
{
label cycOffset = patch.size()/2;
const cyclicPolyPatch& nbrPatch =
refCast<const cyclicPolyPatch>(patch).neighbPatch();
for (label patchFaceI = 0; patchFaceI < cycOffset; patchFaceI++)
forAll(patch, patchFaceI)
{
label i1 = patch.start() + patchFaceI;
label i2 = i1 + cycOffset;
label i2 = nbrPatch.start() + patchFaceI;
if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_))
{
@ -335,8 +336,7 @@ void Foam::FaceCellWave<Type>::mergeFaceInfo
const polyPatch& patch,
const label nFaces,
const labelList& changedFaces,
const List<Type>& changedFacesInfo,
const bool
const List<Type>& changedFacesInfo
)
{
for (label changedFaceI = 0; changedFaceI < nFaces; changedFaceI++)
@ -454,40 +454,6 @@ void Foam::FaceCellWave<Type>::transform
}
// Send face info to neighbour.
template <class Type>
void Foam::FaceCellWave<Type>::sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList& faceLabels,
const List<Type>& faceInfo
) const
{
OPstream toNeighbour(Pstream::blocking, neighbour);
writeFaces(nFaces, faceLabels, faceInfo, toNeighbour);
}
// Receive face info from neighbour
template <class Type>
Foam::label Foam::FaceCellWave<Type>::receivePatchInfo
(
const label neighbour,
labelList& faceLabels,
List<Type>& faceInfo
) const
{
IPstream fromNeighbour(Pstream::blocking, neighbour);
label nFaces = 0;
readFaces(nFaces, faceLabels, faceInfo, fromNeighbour);
return nFaces;
}
// Offset mesh face. Used for transferring from one cyclic half to the other.
template <class Type>
void Foam::FaceCellWave<Type>::offset
@ -511,6 +477,8 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
{
// Send all
PstreamBuffers pBufs(Pstream::nonBlocking);
forAll(mesh_.boundaryMesh(), patchI)
{
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
@ -552,16 +520,13 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
<< endl;
}
sendPatchInfo
(
procPatch.neighbProcNo(),
nSendFaces,
sendFaces,
sendFacesInfo
);
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour);
}
}
pBufs.finishedSends();
// Receive all
forAll(mesh_.boundaryMesh(), patchI)
@ -574,16 +539,20 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
refCast<const processorPolyPatch>(patch);
// Allocate buffers
label nReceiveFaces;
label nReceiveFaces = 0;
labelList receiveFaces(patch.size());
List<Type> receiveFacesInfo(patch.size());
nReceiveFaces = receivePatchInfo
(
procPatch.neighbProcNo(),
receiveFaces,
receiveFacesInfo
);
{
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
readFaces
(
nReceiveFaces,
receiveFaces,
receiveFacesInfo,
fromNeighbour
);
}
if (debug)
{
@ -619,8 +588,7 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
patch,
nReceiveFaces,
receiveFaces,
receiveFacesInfo,
procPatch.parallel()
receiveFacesInfo
);
}
}
@ -639,87 +607,42 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
if (isA<cyclicPolyPatch>(patch))
{
label halfSize = patch.size()/2;
const cyclicPolyPatch& nbrPatch =
refCast<const cyclicPolyPatch>(patch).neighbPatch();
// Allocate buffers
label nSendFaces;
labelList sendFaces(halfSize);
List<Type> sendFacesInfo(halfSize);
label nReceiveFaces;
labelList receiveFaces(halfSize);
List<Type> receiveFacesInfo(halfSize);
labelList receiveFaces(patch.size());
List<Type> receiveFacesInfo(patch.size());
// Half1: Determine which faces changed. Use sendFaces for storage
nSendFaces = getChangedPatchFaces
(
patch,
0,
halfSize,
sendFaces,
sendFacesInfo
);
// Half2: Determine which faces changed. Use receiveFaces_ ,,
// Determine which faces changed
nReceiveFaces = getChangedPatchFaces
(
patch,
halfSize,
halfSize,
nbrPatch,
0,
nbrPatch.size(),
receiveFaces,
receiveFacesInfo
);
//Info<< "Half1:" << endl;
//writeFaces(nSendFaces, sendFaces, sendFacesInfo, Info);
//Info<< endl;
//
//Info<< "Half2:" << endl;
//writeFaces(nReceiveFaces, receiveFaces, receiveFacesInfo, Info);
//Info<< endl;
// Half1: Adapt wallInfo for leaving domain
// Adapt wallInfo for leaving domain
leaveDomain
(
patch,
nSendFaces,
sendFaces,
sendFacesInfo
);
// Half2: Adapt wallInfo for leaving domain
leaveDomain
(
patch,
nbrPatch,
nReceiveFaces,
receiveFaces,
receiveFacesInfo
);
// Half1: 'transfer' to other side by offsetting patchFaceI
offset(patch, halfSize, nSendFaces, sendFaces);
// Half2: 'transfer' to other side
offset(patch, -halfSize, nReceiveFaces, receiveFaces);
// Apply rotation for non-parallel planes
const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(patch);
if (!cycPatch.parallel())
{
// sendFaces = received data from half1
// received data from other half
transform
(
cycPatch.forwardT(),
nSendFaces,
sendFacesInfo
);
// receiveFaces = received data from half2
transform
(
cycPatch.reverseT(),
nReceiveFaces,
receiveFacesInfo
);
@ -727,25 +650,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
if (debug)
{
Pout<< " Cyclic patch " << patchI << ' ' << patch.name()
<< " Changed on first half : " << nSendFaces
<< " Changed on second half : " << nReceiveFaces
Pout<< " Cyclic patch " << patchI << ' ' << cycPatch.name()
<< " Changed : " << nReceiveFaces
<< endl;
}
// Half1: Adapt wallInfo for entering domain
enterDomain
(
patch,
nSendFaces,
sendFaces,
sendFacesInfo
);
// Half2: Adapt wallInfo for entering domain
enterDomain
(
patch,
cycPatch,
nReceiveFaces,
receiveFaces,
receiveFacesInfo
@ -754,25 +667,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
// Merge into global storage
mergeFaceInfo
(
patch,
nSendFaces,
sendFaces,
sendFacesInfo,
cycPatch.parallel()
);
// Merge into global storage
mergeFaceInfo
(
patch,
cycPatch,
nReceiveFaces,
receiveFaces,
receiveFacesInfo,
cycPatch.parallel()
receiveFacesInfo
);
if (debug)
{
checkCyclic(patch);
checkCyclic(cycPatch);
}
}
}

View File

@ -193,8 +193,7 @@ class FaceCellWave
const polyPatch& patch,
const label nFaces,
const labelList&,
const List<Type>&,
const bool isParallel
const List<Type>&
);
//- Extract info for single patch only
@ -225,23 +224,6 @@ class FaceCellWave
List<Type>& faceInfo
) const;
//- Send info to neighbour
void sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList&,
const List<Type>&
) const;
//- Receive info from neighbour. Returns number of faces received.
label receivePatchInfo
(
const label neighbour,
labelList&,
List<Type>&
) const;
//- Offset face labels by constant value
static void offset
(

View File

@ -109,7 +109,6 @@ struct HashTableCore
{
return iteratorEnd();
}
};
@ -139,6 +138,7 @@ class HashTable
//- Construct from key, next pointer and object
inline hashedEntry(const Key&, hashedEntry* next, const T&);
private:
//- Disallow default bitwise copy construct
hashedEntry(const hashedEntry&);
@ -209,9 +209,8 @@ public:
HashTable(const Xfer<HashTable<T, Key, Hash> >&);
// Destructor
~HashTable();
//- Destructor
~HashTable();
// Member Functions
@ -247,6 +246,7 @@ public:
//- Print information
Ostream& printInfo(Ostream&) const;
// Edit
//- Insert a new hashedEntry
@ -291,7 +291,7 @@ public:
void transfer(HashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container
inline Xfer< HashTable<T, Key, Hash> > xfer();
inline Xfer<HashTable<T, Key, Hash> > xfer();
// Member Operators
@ -356,9 +356,8 @@ public:
//- Current hash index
label hashIndex_;
protected:
// Protected Member Functions
protected:
// Constructors
@ -380,6 +379,8 @@ public:
);
// Protected Member Functions
//- Increment to the next position
inline void increment();
@ -392,6 +393,7 @@ public:
//- Return const access to referenced object
inline const T& cobject() const;
public:
// Member operators
@ -434,6 +436,7 @@ public:
const label hashIndex
);
public:
// Constructors
@ -444,13 +447,12 @@ public:
//- Construct end iterator
inline iterator(const iteratorEnd& unused);
// Member operators
//- Conversion to a const_iterator
inline operator const_iterator() const;
// Access
//- Return referenced hash value
inline T& operator*();
inline T& operator()();
@ -492,6 +494,7 @@ public:
const label hashIndex
);
public:
// Constructors
@ -502,9 +505,8 @@ public:
//- Construct end iterator
inline const_iterator(const iteratorEnd& unused);
// Member operators
// Access
// Member operators
//- Return referenced hash value
inline const T& operator*() const;
@ -536,7 +538,6 @@ public:
Ostream&,
const HashTable<T, Key, Hash>&
);
};

View File

@ -97,11 +97,10 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
{}
template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
(
const Xfer< StaticHashTable<T, Key, Hash> >& ht
const Xfer<StaticHashTable<T, Key, Hash> >& ht
)
:
StaticHashTableCore(),
@ -452,7 +451,6 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
}
template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::transfer
(

View File

@ -72,10 +72,6 @@ template<class T, class Key, class Hash> Ostream& operator<<
);
/*---------------------------------------------------------------------------*\
Class StaticHashTableName Declaration
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
Class StaticHashTableCore Declaration
\*---------------------------------------------------------------------------*/
@ -100,7 +96,6 @@ struct StaticHashTableCore
iteratorEnd()
{}
};
};
@ -135,6 +130,7 @@ class StaticHashTable
//- Assign a new hashed entry to a possibly already existing key
bool set(const Key&, const T& newElmt, bool protect);
public:
@ -183,11 +179,11 @@ public:
StaticHashTable(const StaticHashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents
StaticHashTable(const Xfer< StaticHashTable<T, Key, Hash> >&);
StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash> >&);
// Destructor
~StaticHashTable();
//- Destructor
~StaticHashTable();
// Member Functions
@ -251,7 +247,7 @@ public:
void transfer(StaticHashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container
inline Xfer< StaticHashTable<T, Key, Hash> > xfer();
inline Xfer<StaticHashTable<T, Key, Hash> > xfer();
// Member Operators
@ -275,6 +271,7 @@ public:
//- The opposite of the equality operation.
bool operator!=(const StaticHashTable<T, Key, Hash>&) const;
// STL type definitions
//- Type of values the StaticHashTable contains.
@ -317,6 +314,7 @@ public:
//- Index of current element at hashIndex
label elemIndex_;
public:
// Constructors

View File

@ -79,7 +79,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set
template<class T, class Key, class Hash>
inline Foam::Xfer< Foam::StaticHashTable<T, Key, Hash> >
inline Foam::Xfer<Foam::StaticHashTable<T, Key, Hash> >
Foam::StaticHashTable<T, Key, Hash>::xfer()
{
return xferMove(*this);
@ -417,6 +417,4 @@ Foam::StaticHashTable<T, Key, Hash>::end() const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -74,7 +74,7 @@ public:
(
const UList<T>& posList,
const UList<T>& negList,
const Xfer< List<label> >&
const Xfer<List<label> >&
);
@ -102,7 +102,7 @@ public:
//- Reset addressing
inline void resetAddressing(const UList<label>&);
inline void resetAddressing(const Xfer< List<label> >&);
inline void resetAddressing(const Xfer<List<label> >&);
// Member Operators

View File

@ -45,7 +45,7 @@ inline Foam::BiIndirectList<T>::BiIndirectList
(
const UList<T>& posList,
const UList<T>& negList,
const Xfer< List<label> >& addr
const Xfer<List<label> >& addr
)
:
posList_(const_cast<UList<T>&>(posList)),
@ -105,7 +105,7 @@ inline void Foam::BiIndirectList<T>::resetAddressing
template<class T>
inline void Foam::BiIndirectList<T>::resetAddressing
(
const Xfer< List<label> >& addr
const Xfer<List<label> >& addr
)
{
addressing_.transfer(addr());

View File

@ -224,7 +224,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
)
{
label start = offsets_[i];
return UList<T>(&m_[start], offsets_[i+1] - start);
return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
}
@ -238,7 +238,7 @@ Foam::CompactListList<T, Container>::operator[]
label start = offsets_[i];
return UList<T>
(
const_cast<T*>(&m_[start]),
(m_.size() ? const_cast<T*>(&m_[start]) : NULL),
offsets_[i+1] - start
);
}

View File

@ -84,7 +84,6 @@ class DynamicList
//- The capacity (allocated size) of the underlying list.
label capacity_;
// Private Member Functions
public:
@ -93,6 +92,7 @@ public:
//- Declare friendship with the List class
friend class List<T>;
// Constructors
//- Construct null
@ -115,7 +115,7 @@ public:
explicit inline DynamicList(const UIndirectList<T>&);
//- Construct by transferring the parameter contents
explicit inline DynamicList(const Xfer< List<T> >&);
explicit inline DynamicList(const Xfer<List<T> >&);
//- Construct from Istream. Size set to size of read list.
explicit DynamicList(Istream&);
@ -125,103 +125,105 @@ public:
// Access
//- Size of the underlying storage.
inline label capacity() const;
//- Size of the underlying storage.
inline label capacity() const;
// Edit
//- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched.
// Use this or reserve() in combination with append().
inline void setCapacity(const label);
//- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched.
// Use this or reserve() in combination with append().
inline void setCapacity(const label);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void setSize(const label);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void setSize(const label);
//- Alter the addressed list size and fill new space with a constant.
inline void setSize(const label, const T&);
//- Alter the addressed list size and fill new space with a constant.
inline void setSize(const label, const T&);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void resize(const label);
//- Alter the addressed list size.
// New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for
// setting values (as per List usage).
inline void resize(const label);
//- Alter the addressed list size and fill new space with a constant.
inline void resize(const label, const T&);
//- Alter the addressed list size and fill new space with a constant.
inline void resize(const label, const T&);
//- Reserve allocation space for at least this size.
// Never shrinks the allocated size, use setCapacity() for that.
inline void reserve(const label);
//- Reserve allocation space for at least this size.
// Never shrinks the allocated size, use setCapacity() for that.
inline void reserve(const label);
//- Clear the addressed list, i.e. set the size to zero.
// Allocated size does not change
inline void clear();
//- Clear the addressed list, i.e. set the size to zero.
// Allocated size does not change
inline void clear();
//- Clear the list and delete storage.
inline void clearStorage();
//- Clear the list and delete storage.
inline void clearStorage();
//- Shrink the allocated space to the number of elements used.
// Returns a reference to the DynamicList.
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
//- Shrink the allocated space to the number of elements used.
// Returns a reference to the DynamicList.
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
//- Transfer contents of the argument List into this DynamicList
inline void transfer(List<T>&);
//- Transfer contents of the argument List into this DynamicList
inline void transfer(List<T>&);
//- Transfer contents of the argument DynamicList into this DynamicList
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
//- Transfer contents of the argument DynamicList into this DynamicList
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
//- Transfer contents to the Xfer container as a plain List
inline Xfer< List<T> > xfer();
//- Transfer contents to the Xfer container as a plain List
inline Xfer<List<T> > xfer();
// Member Operators
//- Append an element at the end of the list
inline void append(const T&);
// Member Operators
//- Append a List at the end of this list
inline void append(const UList<T>&);
//- Append an element at the end of the list
inline void append(const T&);
//- Append a UIndirectList at the end of this list
inline void append(const UIndirectList<T>&);
//- Append a List at the end of this list
inline void append(const UList<T>&);
//- Remove and return the top element
inline T remove();
//- Append a UIndirectList at the end of this list
inline void append(const UIndirectList<T>&);
//- Return non-const access to an element, resizing list if necessary
inline T& operator()(const label);
//- Remove and return the top element
inline T remove();
//- Assignment of all addressed entries to the given value
inline void operator=(const T&);
//- Return non-const access to an element, resizing list if necessary
inline T& operator()(const label);
//- Assignment from DynamicList
inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Assignment of all addressed entries to the given value
inline void operator=(const T&);
//- Assignment from UList
inline void operator=(const UList<T>&);
//- Assignment from DynamicList
inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
// IOstream operators
//- Assignment from UList
inline void operator=(const UList<T>&);
// Write DynamicList to Ostream.
friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
(
Ostream&,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Read from Istream, discarding contents of existing DynamicList.
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
(
Istream&,
DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
// IOstream operators
// Write DynamicList to Ostream.
friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
(
Ostream&,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Read from Istream, discarding contents of existing DynamicList.
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
(
Istream&,
DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
};

View File

@ -298,7 +298,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::Xfer< Foam::List<T> >
inline Foam::Xfer<Foam::List<T> >
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::xfer()
{
return xferMoveTo< List<T> >(*this);

View File

@ -64,7 +64,8 @@ public:
inline IndirectList(const UList<T>&, const UList<label>&);
//- Construct given the complete list and by transferring addressing
inline IndirectList(const UList<T>&, const Xfer< List<label> >&);
inline IndirectList(const UList<T>&, const Xfer<List<label> >&);
// Member Functions
@ -94,11 +95,12 @@ public:
//- Return the list addressing
inline const List<label>& addressing() const;
// Edit
//- Reset addressing
inline void resetAddressing(const UList<label>&);
inline void resetAddressing(const Xfer< List<label> >&);
inline void resetAddressing(const Xfer<List<label> >&);
// Member Operators

View File

@ -42,7 +42,7 @@ template<class T>
inline Foam::IndirectList<T>::IndirectList
(
const UList<T>& completeList,
const Xfer< List<label> >& addr
const Xfer<List<label> >& addr
)
:
completeList_(const_cast<UList<T>&>(completeList)),
@ -121,7 +121,7 @@ inline void Foam::IndirectList<T>::resetAddressing
template<class T>
inline void Foam::IndirectList<T>::resetAddressing
(
const Xfer< List<label> >& addr
const Xfer<List<label> >& addr
)
{
addressing_.transfer(addr());

View File

@ -38,7 +38,8 @@ Foam::IPstream::IPstream
)
:
Pstream(commsType, bufSize),
UIPstream(commsType, fromProcNo, buf_)
UIPstream(commsType, fromProcNo, buf_, externalBufPosition_),
externalBufPosition_(0)
{}

View File

@ -55,6 +55,9 @@ class IPstream
public UIPstream
{
//- Receive index
label externalBufPosition_;
public:
// Constructors

View File

@ -51,10 +51,31 @@ Foam::PstreamBuffers::PstreamBuffers
version_(version),
sendBuf_(UPstream::nProcs()),
recvBuf_(UPstream::nProcs()),
recvBufPos_(UPstream::nProcs(), 0),
finishedSendsCalled_(false)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::PstreamBuffers::~PstreamBuffers()
{
// Check that all data has been consumed.
forAll(recvBufPos_, procI)
{
if (recvBufPos_[procI] < recvBuf_[procI].size())
{
FatalErrorIn("PstreamBuffers::~PstreamBuffers()")
<< "Message from processor " << procI
<< " not fully consumed. messageSize:" << recvBuf_[procI].size()
<< " bytes of which only " << recvBufPos_[procI]
<< " consumed."
<< Foam::abort(FatalError);
}
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::PstreamBuffers::finishedSends(const bool block)

View File

@ -106,6 +106,9 @@ class PstreamBuffers
//- receive buffer
List<DynamicList<char> > recvBuf_;
//- read position in recvBuf_
labelList recvBufPos_;
bool finishedSendsCalled_;
// Private member functions
@ -129,6 +132,10 @@ public:
IOstream::versionNumber version=IOstream::currentVersion
);
// Destructor
~PstreamBuffers();
// Member functions

View File

@ -77,20 +77,6 @@ inline void Foam::UIPstream::readFromBuffer
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::UIPstream::~UIPstream()
{
if (externalBufPosition_ < messageSize_)
{
FatalErrorIn("UIPstream::~UIPstream()")
<< "Message not fully consumed. messageSize:" << messageSize_
<< " bytes of which only " << externalBufPosition_
<< " consumed." << Foam::abort(FatalError);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Istream& Foam::UIPstream::read(token& t)

View File

@ -63,7 +63,7 @@ class UIPstream
DynamicList<char>& externalBuf_;
label externalBufPosition_;
label& externalBufPosition_;
const int tag_;
@ -94,6 +94,7 @@ public:
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag = UPstream::msgType(),
streamFormat format=BINARY,
versionNumber version=currentVersion
@ -103,11 +104,6 @@ public:
UIPstream(const int fromProcNo, PstreamBuffers&);
// Destructor
~UIPstream();
// Member functions
// Inquiry

View File

@ -220,6 +220,30 @@ Foam::List<int> Foam::UPstream::procIDs_(1, 0);
// Standard transfer message type
int Foam::UPstream::msgType_(1);
// New message type
int Foam::UPstream::freeTag_(msgType()+1);
// Free'd message types
Foam::LIFOStack<int> Foam::UPstream::freedTags_;
int Foam::UPstream::allocateTag()
{
if (freedTags_.empty())
{
return freeTag_++;
}
else
{
return freedTags_.pop();
}
}
void Foam::UPstream::freeTag(const int tag)
{
freedTags_.push(tag);
}
// Linear communication schedule
Foam::List<Foam::UPstream::commsStruct> Foam::UPstream::linearCommunication_(0);

View File

@ -46,6 +46,7 @@ SourceFiles
#include "HashTable.H"
#include "string.H"
#include "NamedEnum.H"
#include "LIFOStack.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -191,6 +192,14 @@ private:
static List<commsStruct> treeCommunication_;
//- Current free tag
static int freeTag_;
//- Freed tags
static LIFOStack<int> freedTags_;
// Private member functions
//- Set data for parallel running
@ -340,6 +349,11 @@ public:
{
return msgType_;
}
//- Allocate new tag
static int allocateTag();
//- Release allocated tag
static void freeTag(const int tag);
//- Get the communications type of the stream

View File

@ -298,7 +298,11 @@ evaluate()
}
// Block for any outstanding requests
if (Pstream::defaultCommsType == Pstream::nonBlocking)
if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking
)
{
Pstream::waitRequests();
}

View File

@ -108,7 +108,8 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
Pstream::blocking,
procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(pf.begin()),
pf.byteSize()
pf.byteSize(),
procPatch_.tag()
);
}
}
@ -126,7 +127,8 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
Pstream::blocking,
procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize()
pnf.byteSize(),
procPatch_.tag()
);
if (doTransform())

View File

@ -109,7 +109,8 @@ const
Pstream::blocking,
procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(pf.begin()),
pf.byteSize()
pf.byteSize(),
procPatch_.tag()
);
}
}
@ -127,7 +128,8 @@ void processorCyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
Pstream::blocking,
procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize()
pnf.byteSize(),
procPatch_.tag()
);
if (doTransform())

View File

@ -33,8 +33,7 @@ Description
#ifndef parRun_H
#define parRun_H
#include "OPstream.H"
#include "IPstream.H"
#include "Pstream.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -95,6 +95,9 @@ public:
//- Return face transformation tensor
virtual const tensor& forwardT() const = 0;
//- Return message tag used for sending
virtual int tag() const = 0;
// //- Set send buffer to sufficient size to hold List<Type>(nElems).
// // Returns reference to buffer (note:buffer.size() is number
// // of characters, not nElems)

View File

@ -87,7 +87,8 @@ void Foam::processorLduInterface::send
commsType,
neighbProcNo(),
reinterpret_cast<const char*>(f.begin()),
f.byteSize()
f.byteSize(),
tag()
);
}
else if (commsType == Pstream::nonBlocking)
@ -100,7 +101,8 @@ void Foam::processorLduInterface::send
commsType,
neighbProcNo(),
receiveBuf_.begin(),
receiveBuf_.size()
receiveBuf_.size(),
tag()
);
//setSendBuf<Type>(f.size());
@ -112,7 +114,8 @@ void Foam::processorLduInterface::send
commsType,
neighbProcNo(),
sendBuf_.begin(),
f.byteSize()
f.byteSize(),
tag()
);
}
else
@ -138,7 +141,8 @@ void Foam::processorLduInterface::receive
commsType,
neighbProcNo(),
reinterpret_cast<char*>(f.begin()),
f.byteSize()
f.byteSize(),
tag()
);
}
else if (commsType == Pstream::nonBlocking)
@ -202,7 +206,8 @@ void Foam::processorLduInterface::compressedSend
commsType,
neighbProcNo(),
sendBuf_.begin(),
nBytes
nBytes,
tag()
);
}
else if (commsType == Pstream::nonBlocking)
@ -215,7 +220,8 @@ void Foam::processorLduInterface::compressedSend
commsType,
neighbProcNo(),
receiveBuf_.begin(),
receiveBuf_.size()
receiveBuf_.size(),
tag()
);
OPstream::write
@ -223,7 +229,8 @@ void Foam::processorLduInterface::compressedSend
commsType,
neighbProcNo(),
sendBuf_.begin(),
nBytes
nBytes,
tag()
);
}
else
@ -264,7 +271,8 @@ void Foam::processorLduInterface::compressedReceive
commsType,
neighbProcNo(),
receiveBuf_.begin(),
nBytes
nBytes,
tag()
);
}
else if (commsType != Pstream::nonBlocking)
@ -350,7 +358,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType,
// neighbProcNo(),
// sendBuf_.begin(),
// sendBuf_.size()
// sendBuf_.size(),
// tag()
// );
// }
// else if (commsType == Pstream::nonBlocking)
@ -362,7 +371,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType,
// neighbProcNo(),
// receiveBuf_.begin(),
// receiveBuf_.size()
// receiveBuf_.size(),
// tag()
// );
//
// OPstream::write
@ -370,7 +380,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType,
// neighbProcNo(),
// sendBuf_.begin(),
// sendBuf_.size()
// sendBuf_.size(),
// tag()
// );
// }
// else
@ -405,7 +416,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType,
// neighbProcNo(),
// receiveBuf_.begin(),
// receiveBuf_.size()
// receiveBuf_.size(),
// tag()
// );
// }
// else if (commsType != Pstream::nonBlocking)
@ -441,7 +453,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType,
// neighbProcNo(),
// receiveBuf_.begin(),
// receiveBuf_.size()
// receiveBuf_.size(),
// tag()
// );
// }
// else if (commsType != Pstream::nonBlocking)

View File

@ -112,10 +112,13 @@ void Foam::lduMatrix::updateMatrixInterfaces
)
{
// Block until all sends/receives have been finished
if (Pstream::defaultCommsType == Pstream::nonBlocking)
if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking
)
{
IPstream::waitRequests();
OPstream::waitRequests();
UPstream::waitRequests();
}
forAll (interfaces, interfaceI)

View File

@ -81,20 +81,13 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix
const Pstream::commsTypes
) const
{
scalarField pnf(size());
label sizeby2 = size()/2;
const unallocLabelList& faceCells = cyclicInterface_.faceCells();
for (label facei=0; facei<sizeby2; facei++)
{
pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
}
// 'send' neighbouring field
scalarField pnf(cyclicInterface_.interfaceInternalField(psiInternal)());
transformCoupleField(pnf, cmpt);
const unallocLabelList& faceCells = cyclicInterface_.faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];

View File

@ -136,6 +136,12 @@ public:
}
}
//- Return message tag to use for communication
virtual int tag() const
{
return procPolyPatch_.tag();
}
//- Return processor number
int myProcNo() const
{

View File

@ -382,7 +382,8 @@ processorCyclicPointPatch::processorCyclicPointPatch
const pointBoundaryMesh& bm
)
:
processorPointPatch(patch, bm)
processorPointPatch(patch, bm),
procCycPolyPatch_(refCast<const processorCyclicPolyPatch>(patch))
{}

View File

@ -60,6 +60,9 @@ class processorCyclicPointPatch
:
public processorPointPatch
{
// Private data
const processorCyclicPolyPatch& procCycPolyPatch_;
//- Disallow default construct as copy
processorCyclicPointPatch(const processorCyclicPointPatch&);
@ -90,6 +93,13 @@ public:
// Member functions
//- Return message tag to use for communication
virtual int tag() const
{
return procCycPolyPatch_.tag();
}
// //- Return true if running parallel
// virtual bool coupled() const
// {

View File

@ -78,34 +78,38 @@ void Foam::globalMeshData::initProcAddr()
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send indices of my processor patches to my neighbours
forAll (processorPatches_, i)
{
label patchi = processorPatches_[i];
OPstream toNeighbour
UOPstream toNeighbour
(
Pstream::blocking,
refCast<const processorPolyPatch>
(
mesh_.boundaryMesh()[patchi]
).neighbProcNo()
).neighbProcNo(),
pBufs
);
toNeighbour << processorPatchIndices_[patchi];
}
pBufs.finishedSends();
forAll(processorPatches_, i)
{
label patchi = processorPatches_[i];
IPstream fromNeighbour
UIPstream fromNeighbour
(
Pstream::blocking,
refCast<const processorPolyPatch>
(
mesh_.boundaryMesh()[patchi]
).neighbProcNo()
).neighbProcNo(),
pBufs
);
fromNeighbour >> processorPatchNeighbours_[patchi];
@ -1560,6 +1564,8 @@ void Foam::globalMeshData::updateMesh()
pointStatus.set(meshPointI, SHARED);
}
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send patch local points
forAll(processorPatches_, i)
{
@ -1568,11 +1574,13 @@ void Foam::globalMeshData::updateMesh()
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
OPstream toNeighbour(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
toNeighbour << procPatch.localPoints();
}
pBufs.finishedSends();
// Receive patch local points and uncount if coincident (and not shared)
forAll(processorPatches_, i)
{
@ -1581,7 +1589,7 @@ void Foam::globalMeshData::updateMesh()
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
IPstream fromNeighbour(Pstream::blocking, procPatch.neighbProcNo());
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
pointField nbrPoints(fromNeighbour);

View File

@ -431,17 +431,16 @@ void Foam::globalPoints::receivePatchPoints
const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp);
const labelList& meshPoints = pp.meshPoints();
const labelList& meshPoints = cycPatch.meshPoints();
const labelList coupledMeshPoints(reverseMeshPoints(cycPatch));
//const edgeList& connections = cycPatch.coupledPoints();
const edgeList connections(coupledPoints(cycPatch));
//const edgeList connections(coupledPoints(cycPatch));
forAll(connections, i)
forAll(meshPoints, i)
{
const edge& e = connections[i];
label meshPointA = meshPoints[e[0]];
label meshPointB = meshPoints[e[1]];
label meshPointA = meshPoints[i];
label meshPointB = coupledMeshPoints[i];
label localA = meshToLocalPoint
(
@ -823,13 +822,15 @@ void Foam::globalPoints::receiveSharedPoints
// Sync all info.
//const edgeList& connections = cycPatch.coupledPoints();
const edgeList connections(coupledPoints(cycPatch));
//const edgeList connections(coupledPoints(cycPatch));
forAll(connections, i)
const labelList& meshPoints = cycPatch.meshPoints();
const labelList coupledMeshPoints(reverseMeshPoints(cycPatch));
forAll(meshPoints, i)
{
const edge& e = connections[i];
label meshPointA = pp.meshPoints()[e[0]];
label meshPointB = pp.meshPoints()[e[1]];
label meshPointA = meshPoints[i];
label meshPointB = coupledMeshPoints[i];
label localA = meshToLocalPoint
(
@ -902,51 +903,25 @@ void Foam::globalPoints::receiveSharedPoints
}
Foam::edgeList Foam::globalPoints::coupledPoints(const cyclicPolyPatch& pp)
Foam::labelList Foam::globalPoints::reverseMeshPoints
(
const cyclicPolyPatch& pp
)
{
// Look at cyclic patch as two halves, A and B.
// Now all we know is that relative face index in halfA is same
// as coupled face in halfB and also that the 0th vertex
// corresponds.
const cyclicPolyPatch& nbrPatch = pp.neighbPatch();
// From halfA point to halfB or -1.
labelList coupledPoint(pp.nPoints(), -1);
faceList masterFaces(nbrPatch.size());
for (label patchFaceA = 0; patchFaceA < pp.size()/2; patchFaceA++)
forAll (nbrPatch, faceI)
{
const face& fA = pp.localFaces()[patchFaceA];
forAll(fA, indexA)
{
label patchPointA = fA[indexA];
if (coupledPoint[patchPointA] == -1)
{
const face& fB = pp.localFaces()[patchFaceA + pp.size()/2];
label indexB = (fB.size() - indexA) % fB.size();
coupledPoint[patchPointA] = fB[indexB];
}
}
masterFaces[faceI] = nbrPatch[faceI].reverseFace();
}
edgeList connected(pp.nPoints());
// Extract coupled points.
label connectedI = 0;
forAll(coupledPoint, i)
{
if (coupledPoint[i] != -1)
{
connected[connectedI++] = edge(i, coupledPoint[i]);
}
}
connected.setSize(connectedI);
return connected;
return primitiveFacePatch
(
masterFaces,
nbrPatch.points()
).meshPoints();
}

View File

@ -156,9 +156,6 @@ class globalPoints
// 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
@ -246,9 +243,8 @@ class globalPoints
labelList&
);
//- Should move into cyclicPolyPatch ordering problem
// keeps on giving problems.
static edgeList coupledPoints(const cyclicPolyPatch&);
//- Return mesh points of other side in same order as my meshPoints.
static labelList reverseMeshPoints(const cyclicPolyPatch&);
//- Do all calculations.
void calculateSharedPoints

View File

@ -75,7 +75,7 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
slave++
)
{
IPstream fromSlave(Pstream::blocking, slave);
IPstream fromSlave(Pstream::scheduled, slave);
List<labelPair> nbrData(fromSlave);
forAll(nbrData, i)
@ -96,18 +96,18 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
slave++
)
{
OPstream toSlave(Pstream::blocking, slave);
OPstream toSlave(Pstream::scheduled, slave);
toSlave << allComms;
}
}
else
{
{
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << allComms;
}
{
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
fromMaster >> allComms;
}
}
@ -596,6 +596,7 @@ void Foam::mapDistribute::compact(const boolList& elemIsUsed)
// Send elemIsUsed field to neighbour. Use nonblocking code from
// mapDistribute but in reverse order.
if (Pstream::parRun())
{
List<boolList> sendFields(Pstream::nProcs());

View File

@ -42,6 +42,30 @@ void Foam::mapDistribute::distribute
List<T>& field
)
{
if (!Pstream::parRun())
{
// Do only me to me.
const labelList& mySubMap = subMap[Pstream::myProcNo()];
List<T> subField(mySubMap.size());
forAll(mySubMap, i)
{
subField[i] = field[mySubMap[i]];
}
// Receive sub field from myself (subField)
const labelList& map = constructMap[Pstream::myProcNo()];
field.setSize(constructSize);
forAll(map, i)
{
field[map[i]] = subField[i];
}
return;
}
if (commsType == Pstream::blocking)
{
// Since buffered sending can reuse the field to collect the
@ -407,6 +431,30 @@ void Foam::mapDistribute::distribute
const T& nullValue
)
{
if (!Pstream::parRun())
{
// Do only me to me.
const labelList& mySubMap = subMap[Pstream::myProcNo()];
List<T> subField(mySubMap.size());
forAll(mySubMap, i)
{
subField[i] = field[mySubMap[i]];
}
// Receive sub field from myself (subField)
const labelList& map = constructMap[Pstream::myProcNo()];
field.setSize(constructSize);
forAll(map, i)
{
field[map[i]] = subField[i];
}
return;
}
if (commsType == Pstream::blocking)
{
// Since buffered sending can reuse the field to collect the

View File

@ -294,13 +294,13 @@ Foam::polyMesh::polyMesh(const IOobject& io)
// Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry();
// Warn if global empty mesh (constructs globalData!)
if (globalData().nTotalPoints() == 0)
// Warn if global empty mesh
if (returnReduce(nPoints(), sumOp<label>()) == 0)
{
WarningIn("polyMesh(const IOobject&)")
<< "no points in mesh" << endl;
}
if (globalData().nTotalCells() == 0)
if (returnReduce(nCells(), sumOp<label>()) == 0)
{
WarningIn("polyMesh(const IOobject&)")
<< "no cells in mesh" << endl;
@ -744,8 +744,12 @@ void Foam::polyMesh::resetPrimitives
// Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry();
// Warn if global empty mesh (constructs globalData!)
if (globalData().nTotalPoints() == 0 || globalData().nTotalCells() == 0)
// Warn if global empty mesh
if
(
(returnReduce(nPoints(), sumOp<label>()) == 0)
|| (returnReduce(nCells(), sumOp<label>()) == 0)
)
{
FatalErrorIn
(

View File

@ -265,7 +265,8 @@ void Foam::coupledPolyPatch::calcTransformTensors
Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl
<< " (half)size:" << Cf.size() << nl
<< " absTol:" << absTol << nl
//<< " smallDist:" << smallDist << nl
<< " smallDist min:" << min(smallDist) << nl
<< " smallDist max:" << max(smallDist) << nl
<< " sum(mag(nf & nr)):" << sum(mag(nf & nr)) << endl;
}
@ -277,7 +278,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
// Then the overall error of summing the normals is sqrt(size())*absTol
// - separation calculation: pass in from the outside an allowable error.
if (size() == 0)
if (Cf.size() == 0)
{
// Dummy geometry.
separated = false;
@ -308,7 +309,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
// Check
forAll (forwardT, facei)
forAll(forwardT, facei)
{
tensor T = rotationTensor(-nr[facei], nf[facei]);

View File

@ -235,6 +235,15 @@ public:
return true;
}
//- Does this side own the patch ?
virtual bool owner() const = 0;
//- Does the coupled side own the patch ?
virtual bool neighbour() const
{
return !owner();
}
//- Transform a patch-based field from other side to this side.
//!! TDB with macros?
virtual bool doTransform() const = 0;

View File

@ -175,13 +175,6 @@ void Foam::cyclicPolyPatch::calcTransforms
const UList<point>& half1Areas
)
{
Pout<< "cyclicPolyPatch::calcTransforms : name:" << name() << endl
<< " half0Ctrs:"
<< " min:" << min(half0Ctrs) << " max:" << max(half0Ctrs)<< endl
<< " half1Ctrs:"
<< " min:" << min(half1Ctrs) << " max:" << max(half1Ctrs)<< endl
<< endl;
if (half0Ctrs.size() != half1Ctrs.size())
{
FatalErrorIn
@ -265,16 +258,6 @@ Pout<< "cyclicPolyPatch::calcTransforms : name:" << name() << endl
half1Normals,
half0Tols
);
Pout<< "cyclicPolyPatch::calcTransforms : calculated transforms for:"
<< name() << endl
<< " separated_:" << separated_ << endl
<< " separation_:" << separation_ << endl
<< " parallel_:" << parallel_ << endl
<< " forwardT_:" << forwardT_ << endl
<< " reverseT_:" << reverseT_ << endl
<< endl;
}
}
@ -445,7 +428,7 @@ Foam::label Foam::cyclicPolyPatch::getConsistentRotationFace
if (debug)
{
Info<< "getConsistentRotationFace(const pointField&)" << nl
Pout<< "getConsistentRotationFace(const pointField&)" << nl
<< " rotFace = " << rotFace << nl
<< " point = " << faceCentres[rotFace] << endl;
}
@ -679,7 +662,7 @@ void Foam::cyclicPolyPatch::calcGeometry
//polyPatch::calcGeometry();
Pout<< "cyclicPolyPatch::calcGeometry : name:" << name()
<< " referred from:" << referPatch.size() << endl;
<< " referred from a patch with nFaces:" << referPatch.size() << endl;
calcTransforms
(
@ -694,7 +677,6 @@ Pout<< "cyclicPolyPatch::calcGeometry : name:" << name()
void Foam::cyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
Pout<< "cyclicPolyPatch::calcGeometry() for " << name() << endl;
calcGeometry
(
*this,

View File

@ -417,34 +417,34 @@ public:
// Low level geometric information
//- Are the coupled planes separated
virtual bool separated() const
{
return separated_;
}
//- Are the coupled planes separated
virtual bool separated() const
{
return separated_;
}
virtual const vector& separation() const
{
return separation_;
}
virtual const vector& separation() const
{
return separation_;
}
//- Are the cyclic planes parallel
virtual bool parallel() const
{
return parallel_;
}
//- Are the cyclic planes parallel
virtual bool parallel() const
{
return parallel_;
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return forwardT_;
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return forwardT_;
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return reverseT_;
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return reverseT_;
}
label transformGlobalFace(const label facei) const
{
@ -466,6 +466,31 @@ public:
}
}
//- Type of transform
transformType transform() const
{
return transform_;
}
//- Axis of rotation for rotational cyclics
const vector& rotationAxis() const
{
return rotationAxis_;
}
//- point on axis of rotation for rotational cyclics
const point& rotationCentre() const
{
return rotationCentre_;
}
//- Translation vector for translational cyclics
const vector& separationVector() const
{
return separationVector_;
}
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)
virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;

View File

@ -158,7 +158,7 @@ Foam::processorPolyPatch::~processorPolyPatch()
void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
Pout<< "**processorPolyPatch::initGeometry()" << endl;
//Pout<< "**processorPolyPatch::initGeometry()" << endl;
if (Pstream::parRun())
{
UOPstream toNeighbProc(neighbProcNo(), pBufs);
@ -187,22 +187,94 @@ Pout<< "processorPolyPatch::calcGeometry() for " << name() << endl;
Pout<< "processorPolyPatch::calcGeometry() : received data for "
<< neighbFaceCentres_.size() << " faces." << endl;
//Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl;
//Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl;
//Pout<< "**neighbFaceCellCentres_:" << neighbFaceCellCentres_ << endl;
calcGeometry
(
*this,
faceCentres(),
faceAreas(),
faceCellCentres()(),
neighbFaceCentres_,
neighbFaceAreas_,
neighbFaceCellCentres_
);
// // My normals
// vectorField faceNormals(size());
//
// // Neighbour normals
// vectorField nbrFaceNormals(neighbFaceAreas_.size());
//
// // Calculate normals from areas and check
// forAll(faceNormals, facei)
// {
// scalar magSf = mag(faceAreas()[facei]);
// scalar nbrMagSf = mag(neighbFaceAreas_[facei]);
// scalar avSf = (magSf + nbrMagSf)/2.0;
//
// if (magSf < ROOTVSMALL && nbrMagSf < ROOTVSMALL)
// {
// // Undetermined normal. Use dummy normal to force separation
// // check. (note use of sqrt(VSMALL) since that is how mag
// // scales)
// faceNormals[facei] = point(1, 0, 0);
// nbrFaceNormals[facei] = faceNormals[facei];
// }
// 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()"
// ) << "face " << facei << " area does not match neighbour by "
// << 100*mag(magSf - nbrMagSf)/avSf
// << "% -- possible face ordering problem." << endl
// << "patch:" << name()
// << " my area:" << magSf
// << " neighbour area:" << nbrMagSf
// << " matching tolerance:" << coupledPolyPatch::matchTol
// << endl
// << "Mesh face:" << start()+facei
// << " vertices:"
// << UIndirectList<point>(points(), operator[](facei))()
// << endl
// << "Rerun with processor debug flag set for"
// << " more information." << exit(FatalError);
// }
// else
// {
// faceNormals[facei] = faceAreas()[facei]/magSf;
// nbrFaceNormals[facei] = neighbFaceAreas_[facei]/nbrMagSf;
// }
// }
//
//
// // Calculate transformation tensors
// calcTransformTensors
// (
// separated_,
// separation_,
// parallel_,
// forwardT_,
// reverseT_,
// faceCentres(),
// neighbFaceCentres_,
// faceNormals,
// nbrFaceNormals,
// calcFaceTol(*this, points(), faceCentres())
// );
//
//Pout<< "cyclicPolyPatch::calcTransforms : calculated transforms for:"
// << name() << endl
// << " separated_:" << separated_ << endl
// << " separation_:" << separation_ << endl
// << " parallel_:" << parallel_ << endl
// << " forwardT_:" << forwardT_ << endl
// << " reverseT_:" << reverseT_ << endl
// << endl;
}
Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl;
Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl;
Pout<< "**neighbFaceCellCentres_:" << neighbFaceCellCentres_ << endl;
}
@ -292,7 +364,7 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
{
// Note cannot predict exact size since opposite nPoints might
// be different from one over here.
IPstream fromNeighbProc(Pstream::blocking, neighbProcNo());
UIPstream fromNeighbProc(neighbProcNo(), pBufs);
fromNeighbProc
>> nbrPointFace

View File

@ -292,6 +292,12 @@ public:
//- Return neighbour edge labels. WIP.
const labelList& neighbEdges() const;
//- Return message tag to use for communication
virtual int tag() const
{
return Pstream::msgType();
}
//- Transform a patch-based field from other side to this side.
virtual bool doTransform() const
{
@ -317,21 +323,21 @@ public:
//- Are the planes separated.
virtual bool separated() const
{
notImplemented("processorPolyPatch::separated(..)");
//notImplemented("processorPolyPatch::separated(..)");
return false;
}
//- If the planes are separated the separation vector.
virtual const vector& separation() const
{
notImplemented("processorPolyPatch::separation(..)");
//notImplemented("processorPolyPatch::separation(..)");
return vector::zero;
}
//- Are the cyclic planes parallel.
virtual bool parallel() const
{
notImplemented("processorPolyPatch::parallel()");
//notImplemented("processorPolyPatch::parallel()");
return true;
}

View File

@ -55,6 +55,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
)
:
processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo),
tag_(UPstream::allocateTag()),
referPatchName_(referPatchName),
referPatchID_(-1)
{}
@ -69,6 +70,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
)
:
processorPolyPatch(name, dict, index, bm),
tag_(UPstream::allocateTag()),
referPatchName_(dict.lookup("referPatch")),
referPatchID_(-1)
{}
@ -81,6 +83,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
)
:
processorPolyPatch(pp, bm),
tag_(pp.tag_),
referPatchName_(pp.referPatchName()),
referPatchID_(-1)
{}
@ -97,6 +100,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
)
:
processorPolyPatch(pp, bm, index, newSize, newStart),
tag_(pp.tag_),
referPatchName_(referPatchName),
referPatchID_(-1)
{}
@ -112,6 +116,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
)
:
processorPolyPatch(pp, bm, index, mapAddressing, newStart),
tag_(pp.tag_),
referPatchName_(pp.referPatchName()),
referPatchID_(-1)
{}
@ -120,7 +125,9 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
{}
{
UPstream::freeTag(tag_);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -128,8 +135,6 @@ Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl;
// Send over processorPolyPatch data
processorPolyPatch::initGeometry(pBufs);
}
@ -137,8 +142,6 @@ Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl;
void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{
Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl;
// Receive and initialise processorPolyPatch data
processorPolyPatch::calcGeometry(pBufs);
@ -158,7 +161,7 @@ Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl;
pp.calcGeometry
(
pp,
*this,
faceCentres(),
faceAreas(),
faceCellCentres(),

View File

@ -55,13 +55,15 @@ class processorCyclicPolyPatch
{
// Private data
//- Message tag to use for communication
const int tag_;
//- Name of originating patch
const word referPatchName_;
//- Index of originating patch
mutable label referPatchID_;
// Private member functions
@ -270,7 +272,19 @@ public:
const coupledPolyPatch& referPatch() const
{
const polyPatch& pp = this->boundaryMesh()[referPatchID()];
return refCast<const processorCyclicPolyPatch>(pp);
return refCast<const coupledPolyPatch>(pp);
}
//- Return message tag to use for communication
virtual int tag() const
{
return tag_;
}
//- Does this side own the patch ?
virtual bool owner() const
{
return referPatch().owner();
}
//- Transform a patch-based field from other side to this side.

View File

@ -137,63 +137,25 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
{
if (patches[patchI].coupled())
{
if
(
Pstream::parRun()
&& isA<processorPolyPatch>(patches[patchI])
)
const coupledPolyPatch& pp =
refCast<const coupledPolyPatch>(patches[patchI]);
const labelList& meshPoints = pp.meshPoints();
forAll(meshPoints, i)
{
const processorPolyPatch& pp =
refCast<const processorPolyPatch>(patches[patchI]);
label pointI = meshPoints[i];
const labelList& meshPoints = pp.meshPoints();
forAll(meshPoints, i)
if (donePoint.get(pointI) == 0u)
{
label pointI = meshPoints[i];
donePoint.set(pointI, 1u);
if (donePoint.get(pointI) == 0u)
if (pp.owner())
{
donePoint.set(pointI, 1u);
if (pp.owner())
{
isMasterPoint.set(pointI, 1u);
}
isMasterPoint.set(pointI, 1u);
}
}
}
else if (isA<cyclicPolyPatch>(patches[patchI]))
{
const cyclicPolyPatch& pp =
refCast<const cyclicPolyPatch>(patches[patchI]);
const edgeList& coupledPoints = pp.coupledPoints();
const labelList& meshPoints = pp.meshPoints();
forAll(coupledPoints, i)
{
// First one of couple points is master
const edge& pointPair = coupledPoints[i];
label p0 = meshPoints[pointPair[0]];
label p1 = meshPoints[pointPair[1]];
if (donePoint.get(p0) == 0u)
{
donePoint.set(p0, 1u);
isMasterPoint.set(p0, 1u);
donePoint.set(p1, 1u);
}
}
}
else
{
FatalErrorIn("syncTools::getMasterPoints(const polyMesh&)")
<< "Cannot handle coupled patch " << patches[patchI].name()
<< " of type " << patches[patchI].type()
<< abort(FatalError);
}
}
}
@ -256,63 +218,25 @@ Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh)
{
if (patches[patchI].coupled())
{
if
(
Pstream::parRun()
&& isA<processorPolyPatch>(patches[patchI])
)
const coupledPolyPatch& pp =
refCast<const coupledPolyPatch>(patches[patchI]);
const labelList& meshEdges = pp.meshEdges();
forAll(meshEdges, i)
{
const processorPolyPatch& pp =
refCast<const processorPolyPatch>(patches[patchI]);
label edgeI = meshEdges[i];
const labelList& meshEdges = pp.meshEdges();
forAll(meshEdges, i)
if (doneEdge.get(edgeI) == 0u)
{
label edgeI = meshEdges[i];
doneEdge.set(edgeI, 1u);
if (doneEdge.get(edgeI) == 0u)
if (pp.owner())
{
doneEdge.set(edgeI, 1u);
if (pp.owner())
{
isMasterEdge.set(edgeI, 1u);
}
isMasterEdge.set(edgeI, 1u);
}
}
}
else if (isA<cyclicPolyPatch>(patches[patchI]))
{
const cyclicPolyPatch& pp =
refCast<const cyclicPolyPatch>(patches[patchI]);
const edgeList& coupledEdges = pp.coupledEdges();
const labelList& meshEdges = pp.meshEdges();
forAll(coupledEdges, i)
{
// First one of couple edges is master
const edge& edgePair = coupledEdges[i];
label e0 = meshEdges[edgePair[0]];
label e1 = meshEdges[edgePair[1]];
if (doneEdge.get(e0) == 0u)
{
doneEdge.set(e0, 1u);
isMasterEdge.set(e0, 1u);
doneEdge.set(e1, 1u);
}
}
}
else
{
FatalErrorIn("syncTools::getMasterEdges(const polyMesh&)")
<< "Cannot handle coupled patch " << patches[patchI].name()
<< " of type " << patches[patchI].type()
<< abort(FatalError);
}
}
}
@ -344,36 +268,16 @@ Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh)
{
if (patches[patchI].coupled())
{
if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI]))
{
const processorPolyPatch& pp =
refCast<const processorPolyPatch>(patches[patchI]);
const coupledPolyPatch& pp =
refCast<const coupledPolyPatch>(patches[patchI]);
if (!pp.owner())
{
forAll(pp, i)
{
isMasterFace.unset(pp.start()+i);
}
}
}
else if (isA<cyclicPolyPatch>(patches[patchI]))
if (!pp.owner())
{
const cyclicPolyPatch& pp =
refCast<const cyclicPolyPatch>(patches[patchI]);
for (label i = pp.size()/2; i < pp.size(); i++)
forAll(pp, i)
{
isMasterFace.unset(pp.start()+i);
}
}
else
{
FatalErrorIn("syncTools::getMasterFaces(const polyMesh&)")
<< "Cannot handle coupled patch " << patches[patchI].name()
<< " of type " << patches[patchI].type()
<< abort(FatalError);
}
}
}

View File

@ -101,6 +101,8 @@ void Foam::syncTools::syncPointMap
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send
forAll(patches, patchI)
@ -134,11 +136,12 @@ void Foam::syncTools::syncPointMap
}
}
OPstream toNeighb(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNeighb(procPatch.neighbProcNo(), pBufs);
toNeighb << patchInfo;
}
}
pBufs.finishedSends();
// Receive and combine.
@ -153,7 +156,7 @@ void Foam::syncTools::syncPointMap
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]);
IPstream fromNb(Pstream::blocking, procPatch.neighbProcNo());
UIPstream fromNb(procPatch.neighbProcNo(), pBufs);
Map<T> nbrPatchInfo(fromNb);
// Transform
@ -198,7 +201,7 @@ void Foam::syncTools::syncPointMap
const labelList& meshPtsA = cycPatch.meshPoints();
const labelList& meshPtsB = nbrPatch.meshPoints();
// Extract local values. Create map from nbrPoint to value.
// Extract local values. Create map from coupled-edge to value.
Map<T> half0Values(meshPtsA.size() / 20);
Map<T> half1Values(half0Values.size());
@ -311,7 +314,7 @@ void Foam::syncTools::syncPointMap
slave++
)
{
IPstream fromSlave(Pstream::blocking, slave);
IPstream fromSlave(Pstream::scheduled, slave);
Map<T> nbrValues(fromSlave);
// Merge neighbouring values with my values
@ -335,7 +338,7 @@ void Foam::syncTools::syncPointMap
slave++
)
{
OPstream toSlave(Pstream::blocking, slave);
OPstream toSlave(Pstream::scheduled, slave);
toSlave << sharedPointValues;
}
}
@ -343,14 +346,14 @@ void Foam::syncTools::syncPointMap
{
// Slave: send to master
{
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << sharedPointValues;
}
// Receive merged values
{
IPstream fromMaster
(
Pstream::blocking,
Pstream::scheduled,
Pstream::masterNo()
);
fromMaster >> sharedPointValues;
@ -416,6 +419,8 @@ void Foam::syncTools::syncEdgeMap
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send
forAll(patches, patchI)
@ -453,11 +458,12 @@ void Foam::syncTools::syncEdgeMap
}
}
OPstream toNeighb(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNeighb(procPatch.neighbProcNo(), pBufs);
toNeighb << patchInfo;
}
}
pBufs.finishedSends();
// Receive and combine.
@ -474,11 +480,7 @@ void Foam::syncTools::syncEdgeMap
EdgeMap<T> nbrPatchInfo;
{
IPstream fromNbr
(
Pstream::blocking,
procPatch.neighbProcNo()
);
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
fromNbr >> nbrPatchInfo;
}
@ -704,7 +706,7 @@ void Foam::syncTools::syncEdgeMap
slave++
)
{
IPstream fromSlave(Pstream::blocking, slave);
IPstream fromSlave(Pstream::scheduled, slave);
EdgeMap<T> nbrValues(fromSlave);
// Merge neighbouring values with my values
@ -729,7 +731,7 @@ void Foam::syncTools::syncEdgeMap
)
{
OPstream toSlave(Pstream::blocking, slave);
OPstream toSlave(Pstream::scheduled, slave);
toSlave << sharedEdgeValues;
}
}
@ -737,12 +739,12 @@ void Foam::syncTools::syncEdgeMap
{
// Send to master
{
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << sharedEdgeValues;
}
// Receive merged values
{
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
fromMaster >> sharedEdgeValues;
}
}
@ -807,6 +809,8 @@ void Foam::syncTools::syncPointList
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send
forAll(patches, patchI)
@ -832,11 +836,12 @@ void Foam::syncTools::syncPointList
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
}
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo;
}
}
pBufs.finishedSends();
// Receive and combine.
@ -853,11 +858,7 @@ void Foam::syncTools::syncPointList
Field<T> nbrPatchInfo(procPatch.nPoints());
{
IPstream fromNbr
(
Pstream::blocking,
procPatch.neighbProcNo()
);
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
fromNbr >> nbrPatchInfo;
}
@ -1032,6 +1033,8 @@ void Foam::syncTools::syncEdgeList
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send
forAll(patches, patchI)
@ -1058,11 +1061,13 @@ void Foam::syncTools::syncEdgeList
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
}
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo;
}
}
pBufs.finishedSends();
// Receive and combine.
forAll(patches, patchI)
@ -1083,11 +1088,7 @@ void Foam::syncTools::syncEdgeList
Field<T> nbrPatchInfo(procPatch.nEdges());
{
IPstream fromNeighb
(
Pstream::blocking,
procPatch.neighbProcNo()
);
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
fromNeighb >> nbrPatchInfo;
}
@ -1215,6 +1216,8 @@ void Foam::syncTools::syncBoundaryFaceList
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send
forAll(patches, patchI)
@ -1230,31 +1233,21 @@ void Foam::syncTools::syncBoundaryFaceList
label patchStart = procPatch.start()-mesh.nInternalFaces();
if (contiguous<T>())
{
OPstream::write
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr <<
SubField<T>
(
Pstream::blocking,
procPatch.neighbProcNo(),
reinterpret_cast<const char*>(&faceValues[patchStart]),
procPatch.size()*sizeof(T)
faceValues,
procPatch.size(),
patchStart
);
}
else
{
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
toNbr <<
SubField<T>
(
faceValues,
procPatch.size(),
patchStart
);
}
}
}
pBufs.finishedSends();
// Receive and combine.
forAll(patches, patchI)
@ -1270,25 +1263,8 @@ void Foam::syncTools::syncBoundaryFaceList
Field<T> nbrPatchInfo(procPatch.size());
if (contiguous<T>())
{
IPstream::read
(
Pstream::blocking,
procPatch.neighbProcNo(),
reinterpret_cast<char*>(nbrPatchInfo.begin()),
nbrPatchInfo.byteSize()
);
}
else
{
IPstream fromNeighb
(
Pstream::blocking,
procPatch.neighbProcNo()
);
fromNeighb >> nbrPatchInfo;
}
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
fromNeighb >> nbrPatchInfo;
top(procPatch, nbrPatchInfo);
@ -1373,6 +1349,8 @@ void Foam::syncTools::syncFaceList
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send
forAll(patches, patchI)
@ -1392,12 +1370,14 @@ void Foam::syncTools::syncFaceList
patchInfo[i] = faceValues[procPatch.start()+i];
}
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo;
}
}
pBufs.finishedSends();
// Receive and combine.
forAll(patches, patchI)
@ -1413,11 +1393,7 @@ void Foam::syncTools::syncFaceList
List<unsigned int> patchInfo(procPatch.size());
{
IPstream fromNbr
(
Pstream::blocking,
procPatch.neighbProcNo()
);
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
fromNbr >> patchInfo;
}
@ -1508,6 +1484,8 @@ void Foam::syncTools::syncPointList
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send
forAll(patches, patchI)
@ -1532,12 +1510,14 @@ void Foam::syncTools::syncPointList
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
}
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo;
}
}
pBufs.finishedSends();
// Receive and combine.
forAll(patches, patchI)
@ -1555,11 +1535,7 @@ void Foam::syncTools::syncPointList
{
// We do not know the number of points on the other side
// so cannot use Pstream::read.
IPstream fromNbr
(
Pstream::blocking,
procPatch.neighbProcNo()
);
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
fromNbr >> nbrPatchInfo;
}
@ -1672,6 +1648,8 @@ void Foam::syncTools::syncEdgeList
if (Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send
forAll(patches, patchI)
@ -1696,11 +1674,12 @@ void Foam::syncTools::syncEdgeList
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
}
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo;
}
}
pBufs.finishedSends();
// Receive and combine.
@ -1719,11 +1698,7 @@ void Foam::syncTools::syncEdgeList
List<unsigned int> nbrPatchInfo(procPatch.nEdges());
{
IPstream fromNeighb
(
Pstream::blocking,
procPatch.neighbProcNo()
);
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
fromNeighb >> nbrPatchInfo;
}

View File

@ -36,6 +36,7 @@ Foam::UIPstream::UIPstream
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag,
streamFormat format,
versionNumber version
@ -45,7 +46,7 @@ Foam::UIPstream::UIPstream
Istream(format, version),
fromProcNo_(fromProcNo),
externalBuf_(externalBuf),
externalBufPosition_(0),
externalBufPosition_(externalBufPosition),
tag_(tag),
messageSize_(0)
{
@ -56,6 +57,7 @@ Foam::UIPstream::UIPstream
"const commsTypes,"
"const int fromProcNo,"
"DynamicList<char>&,"
"label&,"
"const int tag,"
"streamFormat, versionNumber"
")"

View File

@ -40,6 +40,7 @@ Foam::UIPstream::UIPstream
const commsTypes commsType,
const int fromProcNo,
DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag,
streamFormat format,
versionNumber version
@ -49,7 +50,7 @@ Foam::UIPstream::UIPstream
Istream(format, version),
fromProcNo_(fromProcNo),
externalBuf_(externalBuf),
externalBufPosition_(0),
externalBufPosition_(externalBufPosition),
tag_(tag),
messageSize_(0)
{
@ -122,7 +123,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
Istream(buffers.format_, buffers.version_),
fromProcNo_(fromProcNo),
externalBuf_(buffers.recvBuf_[fromProcNo]),
externalBufPosition_(0),
externalBufPosition_(buffers.recvBufPos_[fromProcNo]),
tag_(buffers.tag_),
messageSize_(0)
{

View File

@ -45,7 +45,7 @@ bool Foam::UOPstream::write
{
if (debug)
{
Pout<< "UIPstream::write : starting write to:" << toProcNo
Pout<< "UOPstream::write : starting write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -67,7 +67,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
Pout<< "UOPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -87,7 +87,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
Pout<< "UOPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
@ -110,7 +110,7 @@ bool Foam::UOPstream::write
if (debug)
{
Pout<< "UIPstream::write : started write to:" << toProcNo
Pout<< "UOPstream::write : started write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size()

View File

@ -21,13 +21,12 @@ $(constraintFvPatches)/symmetry/symmetryFvPatch.C
$(constraintFvPatches)/wedge/wedgeFvPatch.C
$(constraintFvPatches)/cyclic/cyclicFvPatch.C
$(constraintFvPatches)/processor/processorFvPatch.C
$(constraintFvPatches)/processorCyclic/processorCyclicFvPatch.C
derivedFvPatches = $(fvPatches)/derived
$(derivedFvPatches)/wall/wallFvPatch.C
/*
$(derivedFvPatches)/directMapped/directMappedFvPatch.C
$(derivedFvPatches)/directMapped/directMappedWallFvPatch.C
*/
wallDist = fvMesh/wallDist
$(wallDist)/wallPointYPlus/wallPointYPlus.C
@ -101,6 +100,8 @@ $(constraintFvPatchFields)/empty/emptyFvPatchFields.C
$(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C
$(constraintFvPatchFields)/processor/processorFvPatchFields.C
$(constraintFvPatchFields)/processor/processorFvPatchScalarField.C
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchScalarField.C
$(constraintFvPatchFields)/symmetry/symmetryFvPatchFields.C
$(constraintFvPatchFields)/wedge/wedgeFvPatchFields.C
$(constraintFvPatchFields)/wedge/wedgeFvPatchScalarField.C
@ -109,15 +110,12 @@ derivedFvPatchFields = $(fvPatchFields)/derived
$(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/advective/advectiveFvPatchFields.C
/*
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
*/
$(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C
/*
$(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
$(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C
$(derivedFvPatchFields)/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C
@ -156,7 +154,6 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
*/
fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
@ -171,6 +168,7 @@ constraintFvsPatchFields = $(fvsPatchFields)/constraint
$(constraintFvsPatchFields)/cyclic/cyclicFvsPatchFields.C
$(constraintFvsPatchFields)/empty/emptyFvsPatchFields.C
$(constraintFvsPatchFields)/processor/processorFvsPatchFields.C
$(constraintFvsPatchFields)/processorCyclic/processorCyclicFvsPatchFields.C
$(constraintFvsPatchFields)/symmetry/symmetryFvsPatchFields.C
$(constraintFvsPatchFields)/wedge/wedgeFvsPatchFields.C
@ -206,7 +204,6 @@ $(surfaceInterpolation)/surfaceInterpolationScheme/surfaceInterpolationSchemes.C
schemes = $(surfaceInterpolation)/schemes
$(schemes)/linear/linear.C
$(schemes)/midPoint/midPoint.C
/*
$(schemes)/downwind/downwind.C
$(schemes)/weighted/weighted.C
$(schemes)/cubic/cubic.C
@ -221,6 +218,7 @@ $(schemes)/localBlended/localBlended.C
$(schemes)/localMax/localMax.C
$(schemes)/localMin/localMin.C
/*
$(schemes)/linearFit/linearFit.C
$(schemes)/biLinearFit/biLinearFit.C
$(schemes)/quadraticLinearFit/quadraticLinearFit.C
@ -236,7 +234,6 @@ $(schemes)/linearPureUpwindFit/linearPureUpwindFit.C
limitedSchemes = $(surfaceInterpolation)/limitedSchemes
$(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationSchemes.C
$(limitedSchemes)/upwind/upwind.C
/*
$(limitedSchemes)/blended/blended.C
$(limitedSchemes)/linearUpwind/linearUpwind.C
$(limitedSchemes)/linearUpwind/linearUpwindV.C
@ -258,7 +255,6 @@ $(limitedSchemes)/filteredLinear/filteredLinear.C
$(limitedSchemes)/filteredLinear2/filteredLinear2.C
$(limitedSchemes)/filteredLinear3/filteredLinear3.C
$(limitedSchemes)/limitWith/limitWith.C
*/
multivariateSchemes = $(surfaceInterpolation)/multivariateSchemes
$(multivariateSchemes)/multivariateSurfaceInterpolationScheme/multivariateSurfaceInterpolationSchemes.C
@ -340,7 +336,6 @@ general = cfdTools/general
$(general)/findRefCell/findRefCell.C
$(general)/adjustPhi/adjustPhi.C
$(general)/bound/bound.C
/*
porousMedia = $(general)/porousMedia
$(porousMedia)/porousZone.C
$(porousMedia)/porousZones.C
@ -363,6 +358,5 @@ $(fieldSources)/timeActivatedExplicitCellSource/timeActivatedExplicitCellSource.
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C
*/
LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -109,9 +109,9 @@ cyclicFvPatchField<Type>::cyclicFvPatchField
<< exit(FatalIOError);
}
Pout<< "Construct from dictionary for " << p.name() << endl
<< "Underlying cyclic:" << cyclicPatch_.name()
<< " with parallel:" << cyclicPatch_.parallel() << endl;
// Pout<< "Construct from dictionary for " << p.name() << endl
// << "Underlying cyclic:" << cyclicPatch_.name()
// << " with parallel:" << cyclicPatch_.parallel() << endl;
this->coupledFvPatchField<Type>::evaluate(Pstream::blocking);
}

View File

@ -100,7 +100,8 @@ template<class Type>
tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const
{
const Field<Type>& iField = this->internalField();
const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
const unallocLabelList& nbrFaceCells =
this->cyclicPatch().neighbFvPatch().faceCells();
tmp<Field<Type> > tpnf(new Field<Type>(this->size()));
Field<Type>& pnf = tpnf();
@ -108,29 +109,21 @@ tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const
tmp<Field<scalar> > tjf = jump();
const Field<scalar>& jf = tjf();
label sizeby2 = this->size()/2;
if (this->doTransform())
{
for (label facei=0; facei<sizeby2; facei++)
forAll(*this, facei)
{
pnf[facei] = transform
(
this->forwardT()[0], iField[faceCells[facei + sizeby2]]
this->forwardT(), iField[nbrFaceCells[facei]]
) - jf[facei];
pnf[facei + sizeby2] = transform
(
this->reverseT()[0], iField[faceCells[facei]] + jf[facei]
);
}
}
else
{
for (label facei=0; facei<sizeby2; facei++)
forAll(*this, facei)
{
pnf[facei] = iField[faceCells[facei + sizeby2]] - jf[facei];
pnf[facei + sizeby2] = iField[faceCells[facei]] + jf[facei];
pnf[facei] = iField[nbrFaceCells[facei]] - jf[facei];
}
}
@ -151,26 +144,24 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
{
scalarField pnf(this->size());
label sizeby2 = this->size()/2;
const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
const unallocLabelList& nbrFaceCells =
this->cyclicPatch().neighbFvPatch().faceCells();
if (&psiInternal == &this->internalField())
{
tmp<Field<scalar> > tjf = jump();
const Field<scalar>& jf = tjf();
for (label facei=0; facei<sizeby2; facei++)
forAll(*this, facei)
{
pnf[facei] = psiInternal[faceCells[facei + sizeby2]] - jf[facei];
pnf[facei + sizeby2] = psiInternal[faceCells[facei]] + jf[facei];
pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei];
}
}
else
{
for (label facei=0; facei<sizeby2; facei++)
forAll(*this, facei)
{
pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
pnf[facei] = psiInternal[nbrFaceCells[facei]];
}
}
@ -178,6 +169,7 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
this->transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result
const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];

View File

@ -74,7 +74,7 @@ processorFvPatchField<Type>::processorFvPatchField
coupledFvPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorFvPatch>(p))
{
if (!isType<processorFvPatch>(this->patch()))
if (!isA<processorFvPatch>(this->patch()))
{
FatalErrorIn
(
@ -106,7 +106,7 @@ processorFvPatchField<Type>::processorFvPatchField
coupledFvPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorFvPatch>(p))
{
if (!isType<processorFvPatch>(p))
if (!isA<processorFvPatch>(p))
{
FatalIOErrorIn
(

View File

@ -0,0 +1,267 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorCyclicFvPatchField.H"
#include "processorCyclicFvPatch.H"
#include "demandDrivenData.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
//coupledFvPatchField<Type>(p, iF),
processorFvPatchField<Type>(p, iF),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{}
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const Field<Type>& f
)
:
//coupledFvPatchField<Type>(p, iF, f),
processorFvPatchField<Type>(p, iF, f),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{}
// Construct by mapping given processorCyclicFvPatchField<Type>
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
//coupledFvPatchField<Type>(ptf, p, iF, mapper),
processorFvPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{
if (!isType<processorCyclicFvPatch>(this->patch()))
{
FatalErrorIn
(
"processorCyclicFvPatchField<Type>::processorCyclicFvPatchField\n"
"(\n"
" const processorCyclicFvPatchField<Type>& ptf,\n"
" const fvPatch& p,\n"
" const DimensionedField<Type, volMesh>& iF,\n"
" const fvPatchFieldMapper& mapper\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
//coupledFvPatchField<Type>(p, iF, dict),
processorFvPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{
if (!isType<processorCyclicFvPatch>(p))
{
FatalIOErrorIn
(
"processorCyclicFvPatchField<Type>::processorCyclicFvPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf
)
:
//processorLduInterfaceField(),
//coupledFvPatchField<Type>(ptf),
processorFvPatchField<Type>(ptf),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{}
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
//coupledFvPatchField<Type>(ptf, iF),
processorFvPatchField<Type>(ptf, iF),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvPatchField<Type>::~processorCyclicFvPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//template<class Type>
//tmp<Field<Type> > processorCyclicFvPatchField<Type>::patchNeighbourField() const
//{
// return *this;
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::initEvaluate
//(
// const Pstream::commsTypes commsType
//)
//{
// if (Pstream::parRun())
// {
// procPatch_.compressedSend(commsType, this->patchInternalField()());
// }
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::evaluate
//(
// const Pstream::commsTypes commsType
//)
//{
// if (Pstream::parRun())
// {
// procPatch_.compressedReceive<Type>(commsType, *this);
//
// if (doTransform())
// {
// transform(*this, procPatch_.forwardT(), *this);
// }
// }
//}
//
//
//template<class Type>
//tmp<Field<Type> > processorCyclicFvPatchField<Type>::snGrad() const
//{
// return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::initInterfaceMatrixUpdate
//(
// const scalarField& psiInternal,
// scalarField&,
// const lduMatrix&,
// const scalarField&,
// const direction,
// const Pstream::commsTypes commsType
//) const
//{
// procPatch_.compressedSend
// (
// commsType,
// this->patch().patchInternalField(psiInternal)()
// );
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::updateInterfaceMatrix
//(
// const scalarField&,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
//) const
//{
// scalarField pnf
// (
// procPatch_.compressedReceive<scalar>(commsType, this->size())()
// );
//
// // Transform according to the transformation tensor
// transformCoupleField(pnf, cmpt);
//
// // Multiply the field by coefficients and add into the result
//
// const unallocLabelList& faceCells = this->patch().faceCells();
//
// forAll(faceCells, elemI)
// {
// result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
// }
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,338 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorCyclicFvPatchField
Description
Foam::processorCyclicFvPatchField
SourceFiles
processorCyclicFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvPatchField_H
#define processorCyclicFvPatchField_H
//#include "coupledFvPatchField.H"
//#include "processorLduInterfaceField.H"
#include "processorCyclicFvPatch.H"
#include "processorFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorCyclicFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class processorCyclicFvPatchField
:
// public processorLduInterfaceField,
// public coupledFvPatchField<Type>
public processorFvPatchField<Type>
{
// Private data
//- Local reference cast into the processor patch
const processorCyclicFvPatch& procPatch_;
// Private Member Functions
// //- Get other patchfield
// const coupledFvPatchField<Type>& patchField(const label patchID) const;
public:
//- Runtime type information
TypeName(processorCyclicFvPatch::typeName_());
// Constructors
//- Construct from patch and internal field
processorCyclicFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch and internal field and patch field
processorCyclicFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const Field<Type>&
);
//- Construct from patch, internal field and dictionary
processorCyclicFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given processorCyclicFvPatchField onto a
// new patch
processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
processorCyclicFvPatchField(const processorCyclicFvPatchField<Type>&);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new processorCyclicFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new processorCyclicFvPatchField<Type>(*this, iF)
);
}
// Destructor
~processorCyclicFvPatchField();
// Member functions
// Access
// //- Return true if running parallel
// virtual bool coupled() const
// {
// if (Pstream::parRun())
// {
// return true;
// }
// else
// {
// return false;
// }
// }
//
// //- Return neighbour field given internal field
// tmp<Field<Type> > patchNeighbourField() const;
//
//
// // Evaluation functions
//
// //- Initialise the evaluation of the patch field
// virtual void initEvaluate(const Pstream::commsTypes commsType);
//
// //- Evaluate the patch field
// virtual void evaluate(const Pstream::commsTypes commsType);
//
// //- Return patch-normal gradient
// virtual tmp<Field<Type> > snGrad() const;
//
// //- Initialise neighbour matrix update
// virtual void initInterfaceMatrixUpdate
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix& m,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
// ) const;
//
// //- Update result field based on interface functionality
// virtual void updateInterfaceMatrix
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix& m,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
// ) const;
//
// //- Processor coupled interface functions
//
// //- Return processor number
// virtual int myProcNo() const
// {
// return procPatch_.myProcNo();
// }
//
// //- Return neigbour processor number
// virtual int neighbProcNo() const
// {
// return procPatch_.neighbProcNo();
// }
//- Does the patch field perform the transfromation
virtual bool doTransform() const
{
return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return procPatch_.forwardT();
}
// //- Return rank of component for transform
// virtual int rank() const
// {
// return pTraits<Type>::rank;
// }
// //- Transform given patch component field
// void transformCoupleField
// (
// scalarField& f,
// const direction cmpt
// ) const;
// // Referred-patch functionality. Get called with a slice (size, start)
// // of a patch that supplies fields and geometry/topology.
//
// //- Get patch-normal gradient
// virtual void snGrad
// (
// Field<Type>& exchangeBuf,
// const Field<Type>& subFld,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start
// ) const
// {
// notImplemented("processorCyclicFvPatchField::snGrad(..)");
// }
//
// //- Initialise the evaluation of the patch field.
// virtual void initEvaluate
// (
// Field<Type>& exchangeBuf,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start
// ) const
// {
// notImplemented("processorCyclicFvPatchField::initEvaluate(..)");
// }
//
// //- Evaluate the patch field.
// virtual void evaluate
// (
// Field<Type>& exchangeBuf,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start
// ) const
// {
// notImplemented("processorCyclicFvPatchField::evaluate(..)");
// }
//
// //- Initialise neighbour matrix update
// virtual void initInterfaceMatrixUpdate
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix& m,
// const scalarField& coeffs,
// const direction cmpt,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start,
// scalarField& exchangeBuf
// ) const
// {
// notImplemented
// (
// "processorCyclicFvPatchField::initInterfaceMatrixUpdate(..)"
// );
// }
//
// //- Update result field based on interface functionality
// virtual void updateInterfaceMatrix
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start,
// scalarField& exchangeBuf
// ) const
// {
// notImplemented
// (
// "processorCyclicFvPatchField::updateInterfaceMatrix(..)"
// );
// }
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorCyclicFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "processorFvPatchFields.H"
#include "processorCyclicFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
@ -35,8 +35,8 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(processor);
//makePatchTypeField(fvPatchScalarField, processorFvPatchScalarField);
makePatchFields(processorCyclic);
//makePatchTypeField(fvPatchScalarField, processorCyclicFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,10 +24,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef processorFvPatchFields_H
#define processorFvPatchFields_H
#ifndef processorCyclicFvPatchFields_H
#define processorCyclicFvPatchFields_H
#include "processorFvPatchScalarField.H"
#include "processorCyclicFvPatchScalarField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -37,7 +37,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(processor)
makePatchTypeFieldTypedefs(processorCyclic)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,8 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#ifndef processorFvPatchFieldsFwd_H
#define processorFvPatchFieldsFwd_H
#ifndef processorCyclicFvPatchFieldsFwd_H
#define processorCyclicFvPatchFieldsFwd_H
#include "fieldTypes.H"
@ -36,7 +36,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class processorFvPatchField;
template<class Type> class processorCyclicFvPatchField;
makePatchTypeFieldTypedefs(processor)

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "processorFvPatchScalarField.H"
#include "processorCyclicFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -33,48 +33,48 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<>
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField&,
const lduMatrix&,
const scalarField&,
const direction,
const Pstream::commsTypes commsType
) const
{
procPatch_.compressedSend
(
commsType,
patch().patchInternalField(psiInternal)()
);
}
template<>
void processorFvPatchField<scalar>::updateInterfaceMatrix
(
const scalarField&,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const
{
scalarField pnf
(
procPatch_.compressedReceive<scalar>(commsType, this->size())()
);
const unallocLabelList& faceCells = patch().faceCells();
forAll(faceCells, facei)
{
result[faceCells[facei]] -= coeffs[facei]*pnf[facei];
}
}
//template<>
//void processorCyclicFvPatchField<scalar>::initInterfaceMatrixUpdate
//(
// const scalarField& psiInternal,
// scalarField&,
// const lduMatrix&,
// const scalarField&,
// const direction,
// const Pstream::commsTypes commsType
//) const
//{
// procPatch_.compressedSend
// (
// commsType,
// patch().patchInternalField(psiInternal)()
// );
//}
//
//
//template<>
//void processorCyclicFvPatchField<scalar>::updateInterfaceMatrix
//(
// const scalarField&,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction,
// const Pstream::commsTypes commsType
//) const
//{
// scalarField pnf
// (
// procPatch_.compressedReceive<scalar>(commsType, this->size())()
// );
//
// const unallocLabelList& faceCells = patch().faceCells();
//
// forAll(faceCells, facei)
// {
// result[faceCells[facei]] -= coeffs[facei]*pnf[facei];
// }
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,10 +24,10 @@ License
\*---------------------------------------------------------------------------*/
#ifndef processorFvPatchScalarField_H
#define processorFvPatchScalarField_H
#ifndef processorCyclicFvPatchScalarField_H
#define processorCyclicFvPatchScalarField_H
#include "processorFvPatchField.H"
#include "processorCyclicFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -36,28 +36,28 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<>
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
(
const scalarField&,
scalarField&,
const lduMatrix&,
const scalarField&,
const direction,
const Pstream::commsTypes commsType
) const;
template<>
void processorFvPatchField<scalar>::updateInterfaceMatrix
(
const scalarField&,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction,
const Pstream::commsTypes commsType
) const;
//template<>
//void processorCyclicFvPatchField<scalar>::initInterfaceMatrixUpdate
//(
// const scalarField&,
// scalarField&,
// const lduMatrix&,
// const scalarField&,
// const direction,
// const Pstream::commsTypes commsType
//) const;
//
//
//template<>
//void processorCyclicFvPatchField<scalar>::updateInterfaceMatrix
//(
// const scalarField&,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction,
// const Pstream::commsTypes commsType
//) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,261 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorFvPatchField.H"
#include "processorFvPatch.H"
#include "demandDrivenData.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
coupledFvPatchField<Type>(p, iF),
procPatch_(refCast<const processorFvPatch>(p))
{}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const Field<Type>& f
)
:
coupledFvPatchField<Type>(p, iF, f),
procPatch_(refCast<const processorFvPatch>(p))
{}
// Construct by mapping given processorFvPatchField<Type>
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
coupledFvPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorFvPatch>(p))
{
if (!isType<processorFvPatch>(this->patch()))
{
FatalErrorIn
(
"processorFvPatchField<Type>::processorFvPatchField\n"
"(\n"
" const processorFvPatchField<Type>& ptf,\n"
" const fvPatch& p,\n"
" const DimensionedField<Type, volMesh>& iF,\n"
" const fvPatchFieldMapper& mapper\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
coupledFvPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorFvPatch>(p))
{
if (!isType<processorFvPatch>(p))
{
FatalIOErrorIn
(
"processorFvPatchField<Type>::processorFvPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf
)
:
processorLduInterfaceField(),
coupledFvPatchField<Type>(ptf),
procPatch_(refCast<const processorFvPatch>(ptf.patch()))
{}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
coupledFvPatchField<Type>(ptf, iF),
procPatch_(refCast<const processorFvPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorFvPatchField<Type>::~processorFvPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const
{
return *this;
}
template<class Type>
void processorFvPatchField<Type>::initEvaluate
(
const Pstream::commsTypes commsType
)
{
if (Pstream::parRun())
{
procPatch_.compressedSend(commsType, this->patchInternalField()());
}
}
template<class Type>
void processorFvPatchField<Type>::evaluate
(
const Pstream::commsTypes commsType
)
{
if (Pstream::parRun())
{
procPatch_.compressedReceive<Type>(commsType, *this);
if (doTransform())
{
transform(*this, procPatch_.forwardT(), *this);
}
}
}
template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const
{
return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
}
template<class Type>
void processorFvPatchField<Type>::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField&,
const lduMatrix&,
const scalarField&,
const direction,
const Pstream::commsTypes commsType
) const
{
procPatch_.compressedSend
(
commsType,
this->patch().patchInternalField(psiInternal)()
);
}
template<class Type>
void processorFvPatchField<Type>::updateInterfaceMatrix
(
const scalarField&,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const
{
scalarField pnf
(
procPatch_.compressedReceive<scalar>(commsType, this->size())()
);
// Transform according to the transformation tensor
transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result
const unallocLabelList& faceCells = this->patch().faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,323 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorFvPatchField
Description
Foam::processorFvPatchField
SourceFiles
processorFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef processorFvPatchField_H
#define processorFvPatchField_H
#include "coupledFvPatchField.H"
#include "processorLduInterfaceField.H"
#include "processorFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class processorFvPatchField
:
public processorLduInterfaceField,
public coupledFvPatchField<Type>
{
// Private data
//- Local reference cast into the processor patch
const processorFvPatch& procPatch_;
// Private Member Functions
//- Get other patchfield
const coupledFvPatchField<Type>& patchField(const label patchID) const;
public:
//- Runtime type information
TypeName(processorFvPatch::typeName_());
// Constructors
//- Construct from patch and internal field
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch and internal field and patch field
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const Field<Type>&
);
//- Construct from patch, internal field and dictionary
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given processorFvPatchField onto a new patch
processorFvPatchField
(
const processorFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
processorFvPatchField(const processorFvPatchField<Type>&);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new processorFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
processorFvPatchField
(
const processorFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new processorFvPatchField<Type>(*this, iF)
);
}
// Destructor
~processorFvPatchField();
// Member functions
// Access
//- Return true if running parallel
virtual bool coupled() const
{
if (Pstream::parRun())
{
return true;
}
else
{
return false;
}
}
//- Return neighbour field given internal field
tmp<Field<Type> > patchNeighbourField() const;
// Evaluation functions
//- Initialise the evaluation of the patch field
virtual void initEvaluate(const Pstream::commsTypes commsType);
//- Evaluate the patch field
virtual void evaluate(const Pstream::commsTypes commsType);
//- Return patch-normal gradient
virtual tmp<Field<Type> > snGrad() const;
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
//- Processor coupled interface functions
//- Return processor number
virtual int myProcNo() const
{
return procPatch_.myProcNo();
}
//- Return neigbour processor number
virtual int neighbProcNo() const
{
return procPatch_.neighbProcNo();
}
//- Return rank of component for transform
virtual int rank() const
{
return pTraits<Type>::rank;
}
// //- Transform given patch component field
// void transformCoupleField
// (
// scalarField& f,
// const direction cmpt
// ) const;
// Referred-patch functionality. Get called with a slice (size, start)
// of a patch that supplies fields and geometry/topology.
//- Get patch-normal gradient
virtual void snGrad
(
Field<Type>& exchangeBuf,
const Field<Type>& subFld,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::snGrad(..)");
}
//- Initialise the evaluation of the patch field.
virtual void initEvaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::initEvaluate(..)");
}
//- Evaluate the patch field.
virtual void evaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::evaluate(..)");
}
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
notImplemented
(
"processorFvPatchField::initInterfaceMatrixUpdate(..)"
);
}
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
notImplemented
(
"processorFvPatchField::updateInterfaceMatrix(..)"
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -28,6 +28,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "cyclicFvPatch.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -45,6 +46,7 @@ activeBaffleVelocityFvPatchVectorField
orientation_(1),
initWallSf_(0),
initCyclicSf_(0),
nbrCyclicSf_(0),
openFraction_(0),
openingTime_(0),
maxOpenFractionDelta_(0),
@ -68,6 +70,7 @@ activeBaffleVelocityFvPatchVectorField
orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_),
nbrCyclicSf_(ptf.nbrCyclicSf_),
openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
@ -84,23 +87,25 @@ activeBaffleVelocityFvPatchVectorField
)
:
fixedValueFvPatchVectorField(p, iF),
pName_("p"),
pName_(dict.lookupOrDefault<word>("p", "p")),
cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),
orientation_(readLabel(dict.lookup("orientation"))),
initWallSf_(p.Sf()),
initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()),
nbrCyclicSf_
(
refCast<const cyclicFvPatch>
(
p.boundaryMesh()[cyclicPatchLabel_]
).neighbFvPatch().Sf()
),
openFraction_(readScalar(dict.lookup("openFraction"))),
openingTime_(readScalar(dict.lookup("openingTime"))),
maxOpenFractionDelta_(readScalar(dict.lookup("maxOpenFractionDelta"))),
curTimeIndex_(-1)
{
fvPatchVectorField::operator=(vector::zero);
if (dict.found("p"))
{
dict.lookup("p") >> pName_;
}
}
@ -117,6 +122,7 @@ activeBaffleVelocityFvPatchVectorField
orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_),
nbrCyclicSf_(ptf.nbrCyclicSf_),
openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
@ -138,6 +144,7 @@ activeBaffleVelocityFvPatchVectorField
orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_),
nbrCyclicSf_(ptf.nbrCyclicSf_),
openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
@ -166,6 +173,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::autoMap
[
cyclicPatchLabel_
].patchSlice(areas);
nbrCyclicSf_ = refCast<const cyclicFvPatch>
(
patch().boundaryMesh()
[
cyclicPatchLabel_
]
).neighbFvPatch().patch().patchSlice(areas);
}
void Foam::activeBaffleVelocityFvPatchVectorField::rmap
@ -183,6 +197,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::rmap
[
cyclicPatchLabel_
].patchSlice(areas);
nbrCyclicSf_ = refCast<const cyclicFvPatch>
(
patch().boundaryMesh()
[
cyclicPatchLabel_
]
).neighbFvPatch().patch().patchSlice(areas);
}
@ -203,31 +224,42 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_];
const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
label nCyclicFaces = cyclicFaceCells.size();
label nCyclicFacesPerSide = nCyclicFaces/2;
const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
(
cyclicPatch
).neighbFvPatch();
const labelList& nbrFaceCells = nbrPatch.patch().faceCells();
scalar forceDiff = 0;
for (label facei=0; facei<nCyclicFacesPerSide; facei++)
// Add this side
forAll(cyclicFaceCells, facei)
{
forceDiff += p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]);
}
for (label facei=nCyclicFacesPerSide; facei<nCyclicFaces; facei++)
// Remove other side
forAll(nbrFaceCells, facei)
{
forceDiff -= p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]);
forceDiff -= p[nbrFaceCells[facei]]*mag(nbrCyclicSf_[facei]);
}
openFraction_ =
max(min(
openFraction_
+ max
max
(
min
(
this->db().time().deltaTValue()/openingTime_,
maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),
1 - 1e-6), 1e-6);
openFraction_
+ max
(
this->db().time().deltaTValue()/openingTime_,
maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),
1 - 1e-6
),
1e-6
);
Info<< "openFraction = " << openFraction_ << endl;
@ -239,10 +271,16 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
}
const_cast<scalarField&>(patch().magSf()) = mag(patch().Sf());
// Update owner side of cyclic
const_cast<vectorField&>(cyclicPatch.Sf()) =
openFraction_*initCyclicSf_;
const_cast<scalarField&>(cyclicPatch.magSf()) =
mag(cyclicPatch.Sf());
// Update neighbour side of cyclic
const_cast<vectorField&>(nbrPatch.Sf()) =
openFraction_*nbrCyclicSf_;
const_cast<scalarField&>(nbrPatch.magSf()) =
mag(nbrPatch.Sf());
curTimeIndex_ = this->db().time().timeIndex();
}
@ -264,8 +302,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const
<< maxOpenFractionDelta_ << token::END_STATEMENT << nl;
os.writeKeyword("openFraction")
<< openFraction_ << token::END_STATEMENT << nl;
os.writeKeyword("p")
<< pName_ << token::END_STATEMENT << nl;
writeEntryIfDifferent<word>(os, "p", "p", pName_);
writeEntry("value", os);
}

View File

@ -72,9 +72,12 @@ class activeBaffleVelocityFvPatchVectorField
//- Initial wall patch areas
vectorField initWallSf_;
//- Initial cyclic patch areas
//- Initial this-side cyclic patch areas
vectorField initCyclicSf_;
//- Initial neighbour-side cyclic patch areas
vectorField nbrCyclicSf_;
//- Current fraction of the active baffle which is open
scalar openFraction_;

View File

@ -43,7 +43,7 @@ fanFvPatchField<Type>::fanFvPatchField
:
jumpCyclicFvPatchField<Type>(p, iF),
f_(0),
jump_(this->size()/2, 0.0)
jump_(this->size(), 0.0)
{}
@ -72,12 +72,14 @@ fanFvPatchField<Type>::fanFvPatchField
:
jumpCyclicFvPatchField<Type>(p, iF),
f_(),
jump_(this->size()/2, 0.0)
jump_(this->size(), 0.0)
{
{
Istream& is = dict.lookup("f");
is.format(IOstream::ASCII);
is >> f_;
// Check that f_ table is same on both sides.?
}
if (dict.found("value"))
@ -129,21 +131,7 @@ void fanFvPatchField<Type>::autoMap
)
{
jumpCyclicFvPatchField<Type>::autoMap(m);
// Jump is half size. Expand to full size, map and truncate.
if (jump_.size() && jump_.size() == this->size()/2)
{
label oldSize = jump_.size();
jump_.setSize(this->size());
for (label i = oldSize; i < jump_.size(); i++)
{
jump_[i] = jump_[i-oldSize];
}
jump_.autoMap(m);
jump_.setSize(oldSize);
}
jump_.autoMap(m);
}
@ -156,24 +144,9 @@ void fanFvPatchField<Type>::rmap
{
jumpCyclicFvPatchField<Type>::rmap(ptf, addr);
// Jump is half size. Expand to full size, map and truncate.
if (jump_.size() && jump_.size() == this->size()/2)
{
label oldSize = jump_.size();
jump_.setSize(this->size());
for (label i = oldSize; i < jump_.size(); i++)
{
jump_[i] = jump_[i-oldSize];
}
const fanFvPatchField<Type>& tiptf =
refCast<const fanFvPatchField<Type> >(ptf);
jump_.rmap(tiptf.jump_, addr);
jump_.setSize(oldSize);
}
const fanFvPatchField<Type>& tiptf =
refCast<const fanFvPatchField<Type> >(ptf);
jump_.rmap(tiptf.jump_, addr);
}

View File

@ -132,7 +132,13 @@ public:
// Access
//- Return the "jump" across the patch as a "half" field
//- Return the polynomial coefficients
const List<scalar>& f() const
{
return f_;
}
//- Return the "jump" across the patch.
virtual tmp<Field<Type> > jump() const
{
return jump_;

View File

@ -47,6 +47,7 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
return;
}
// Constant
jump_ = f_[0];
if (f_.size() > 1)
@ -57,21 +58,11 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
scalarField Un = max
(
scalarField::subField(phip, size()/2)
/scalarField::subField(patch().magSf(), size()/2),
scalar(0)
);
scalarField Un = max(phip/patch().magSf(), scalar(0));
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
Un /=
scalarField::subField
(
patch().lookupPatchField<volScalarField, scalar>("rho"),
size()/2
);
Un /= patch().lookupPatchField<volScalarField, scalar>("rho");
}
for (label i=1; i<f_.size(); i++)

View File

@ -0,0 +1,157 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorCyclicFvsPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF
)
:
coupledFvsPatchField<Type>(p, iF),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{}
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const Field<Type>& f
)
:
coupledFvsPatchField<Type>(p, iF, f),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{}
// Construct by mapping given processorCyclicFvsPatchField<Type>
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
coupledFvsPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{
if (!isType<processorCyclicFvPatch>(this->patch()))
{
FatalErrorIn
(
"processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField\n"
"(\n"
" const processorCyclicFvsPatchField<Type>& ptf,\n"
" const fvPatch& p,\n"
" const DimensionedField<Type, surfaceMesh>& iF,\n"
" const fvPatchFieldMapper& mapper\n"
")\n"
) << "Field type does not correspond to patch type for patch "
<< this->patch().index() << "." << endl
<< "Field type: " << typeName << endl
<< "Patch type: " << this->patch().type()
<< exit(FatalError);
}
}
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const dictionary& dict
)
:
coupledFvsPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{
if (!isType<processorCyclicFvPatch>(p))
{
FatalIOErrorIn
(
"processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "patch " << this->patch().index() << " not processor type. "
<< "Patch type = " << p.type()
<< exit(FatalIOError);
}
}
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>& ptf
)
:
coupledFvsPatchField<Type>(ptf),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{}
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>& ptf,
const DimensionedField<Type, surfaceMesh>& iF
)
:
coupledFvsPatchField<Type>(ptf, iF),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvsPatchField<Type>::~processorCyclicFvsPatchField()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorCyclicFvsPatchField
Description
Foam::processorCyclicFvsPatchField
SourceFiles
processorCyclicFvsPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvsPatchField_H
#define processorCyclicFvsPatchField_H
#include "coupledFvsPatchField.H"
#include "processorCyclicFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorCyclicFvsPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class processorCyclicFvsPatchField
:
public coupledFvsPatchField<Type>
{
// Private data
//- Local reference cast into the processor patch
const processorCyclicFvPatch& procPatch_;
public:
//- Runtime type information
TypeName(processorCyclicFvPatch::typeName_());
// Constructors
//- Construct from patch and internal field
processorCyclicFvsPatchField
(
const fvPatch&,
const DimensionedField<Type, surfaceMesh>&
);
//- Construct from patch and internal field and patch field
processorCyclicFvsPatchField
(
const fvPatch&,
const DimensionedField<Type, surfaceMesh>&,
const Field<Type>&
);
//- Construct from patch, internal field and dictionary
processorCyclicFvsPatchField
(
const fvPatch&,
const DimensionedField<Type, surfaceMesh>&,
const dictionary&
);
//- Construct by mapping given processorCyclicFvsPatchField onto a
// new patch
processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, surfaceMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
processorCyclicFvsPatchField(const processorCyclicFvsPatchField<Type>&);
//- Construct and return a clone
virtual tmp<fvsPatchField<Type> > clone() const
{
return tmp<fvsPatchField<Type> >
(
new processorCyclicFvsPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>&,
const DimensionedField<Type, surfaceMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvsPatchField<Type> > clone
(
const DimensionedField<Type, surfaceMesh>& iF
) const
{
return tmp<fvsPatchField<Type> >
(
new processorCyclicFvsPatchField<Type>(*this, iF)
);
}
// Destructor
~processorCyclicFvsPatchField();
// Member functions
// Access
//- Return true if running parallel
virtual bool coupled() const
{
if (Pstream::parRun())
{
return true;
}
else
{
return false;
}
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorCyclicFvsPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorCyclicFvsPatchFields.H"
#include "fvsPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFvsPatchFields(processorCyclic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvsPatchFields_H
#define processorCyclicFvsPatchFields_H
#include "processorCyclicFvsPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvsPatchTypeFieldTypedefs(processorCyclic)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvsPatchFieldsFwd_H
#define processorCyclicFvsPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class processorCyclicFvsPatchField;
makeFvsPatchTypeFieldTypedefs(processor)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -103,6 +103,8 @@ void Foam::fvMeshSubset::doCoupledPatches
if (syncPar && Pstream::parRun())
{
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send face usage across processor patches
forAll (oldPatches, oldPatchI)
{
@ -113,17 +115,14 @@ void Foam::fvMeshSubset::doCoupledPatches
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
OPstream toNeighbour
(
Pstream::blocking,
procPatch.neighbProcNo()
);
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
toNeighbour
<< SubList<label>(nCellsUsingFace, pp.size(), pp.start());
}
}
pBufs.finishedSends();
// Receive face usage count and check for faces that become uncoupled.
forAll (oldPatches, oldPatchI)
@ -135,11 +134,7 @@ void Foam::fvMeshSubset::doCoupledPatches
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
IPstream fromNeighbour
(
Pstream::blocking,
procPatch.neighbProcNo()
);
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
labelList nbrCellsUsingFace(fromNeighbour);

View File

@ -100,6 +100,12 @@ public:
return procPolyPatch_.neighbProcNo();
}
//- Return message tag used for sending
virtual int tag() const
{
return UPstream::msgType();
}
//- Return true if running parallel
virtual bool coupled() const
{

View File

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorCyclicFvPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(processorCyclicFvPatch, 0);
addToRunTimeSelectionTable(fvPatch, processorCyclicFvPatch, polyPatch);
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
//void processorCyclicFvPatch::makeWeights(scalarField& w) const
//{
// if (Pstream::parRun())
// {
// // The face normals point in the opposite direction on the other side
// scalarField neighbFaceCentresCn
// (
// (
// procPolyPatch_.neighbFaceAreas()
// /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
// )
// & (
// procPolyPatch_.neighbFaceCentres()
// - procPolyPatch_.neighbFaceCellCentres())
// );
//
// w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn);
// }
// else
// {
// w = 1.0;
// }
//}
//
//
//void processorCyclicFvPatch::makeDeltaCoeffs(scalarField& dc) const
//{
// if (Pstream::parRun())
// {
// dc = (1.0 - weights())/(nf() & fvPatch::delta());
// }
// else
// {
// dc = 1.0/(nf() & fvPatch::delta());
// }
//}
//
//
//tmp<vectorField> processorCyclicFvPatch::delta() const
//{
// if (Pstream::parRun())
// {
// // To the transformation if necessary
// if (parallel())
// {
// return
// fvPatch::delta()
// - (
// procPolyPatch_.neighbFaceCentres()
// - procPolyPatch_.neighbFaceCellCentres()
// );
// }
// else
// {
// return
// fvPatch::delta()
// - transform
// (
// forwardT(),
// (
// procPolyPatch_.neighbFaceCentres()
// - procPolyPatch_.neighbFaceCellCentres()
// )
// );
// }
// }
// else
// {
// return fvPatch::delta();
// }
//}
//
//
//tmp<labelField> processorCyclicFvPatch::interfaceInternalField
//(
// const unallocLabelList& internalData
//) const
//{
// return patchInternalField(internalData);
//}
// void processorCyclicFvPatch::initTransfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& interfaceData
// ) const
// {
// send(commsType, interfaceData);
// }
//
//
// tmp<labelField> processorCyclicFvPatch::transfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList&
// ) const
// {
// return receive<label>(commsType, this->size());
// }
//void processorCyclicFvPatch::initInternalFieldTransfer
//(
// const Pstream::commsTypes commsType,
// const unallocLabelList& iF
//) const
//{
// send(commsType, patchInternalField(iF)());
//}
//
//
//tmp<labelField> processorCyclicFvPatch::internalFieldTransfer
//(
// const Pstream::commsTypes commsType,
// const unallocLabelList&
//) const
//{
// return receive<label>(commsType, this->size());
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,214 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorCyclicFvPatch
Description
Processor patch.
SourceFiles
processorCyclicFvPatch.C
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvPatch_H
#define processorCyclicFvPatch_H
//#include "coupledFvPatch.H"
//#include "processorLduInterface.H"
#include "processorCyclicPolyPatch.H"
#include "processorFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorCyclicFvPatch Declaration
\*---------------------------------------------------------------------------*/
class processorCyclicFvPatch
:
// public coupledFvPatch,
// public processorLduInterface
public processorFvPatch
{
// Private Data
const processorCyclicPolyPatch& procPolyPatch_;
//protected:
//
// // Protected Member functions
//
// //- Make patch weighting factors
// void makeWeights(scalarField&) const;
//
// //- Make patch face - neighbour cell distances
// void makeDeltaCoeffs(scalarField&) const;
public:
//- Runtime type information
TypeName(processorCyclicPolyPatch::typeName_());
// Constructors
//- Construct from components
processorCyclicFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
:
// coupledFvPatch(patch, bm),
processorFvPatch(patch, bm),
procPolyPatch_(refCast<const processorCyclicPolyPatch>(patch))
{}
// Member functions
// //- Return processor number
// int myProcNo() const
// {
// return procPolyPatch_.myProcNo();
// }
//
// //- Return neigbour processor number
// int neighbProcNo() const
// {
// return procPolyPatch_.neighbProcNo();
// }
//
// //- Return true if running parallel
// virtual bool coupled() const
// {
// if (Pstream::parRun())
// {
// return true;
// }
// else
// {
// return false;
// }
// }
//- Return message tag used for sending
virtual int tag() const
{
// Allocate from Pstream?
return procPolyPatch_.tag();
}
const processorCyclicPolyPatch& procPolyPatch() const
{
return procPolyPatch_;
}
// //- Are the planes separated.
// virtual bool separated() const
// {
// return procPolyPatch_.separated();
// }
//
// //- If the planes are separated the separation vector.
// virtual const vector& separation() const
// {
// return procPolyPatch_.separation();
// }
//
//- Are the cyclic planes parallel
virtual bool parallel() const
{
return procPolyPatch_.parallel();
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return procPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return procPolyPatch_.reverseT();
}
//
//
// //- Return delta (P to N) vectors across coupled patch
// virtual tmp<vectorField> delta() const;
// Interface transfer functions
// //- Return the values of the given internal data adjacent to
// // the interface as a field
// virtual tmp<labelField> interfaceInternalField
// (
// const unallocLabelList& internalData
// ) const;
// //- Initialise interface data transfer
// virtual void initTransfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& interfaceData
// ) const;
//
// //- Transfer and return neighbour field
// virtual tmp<labelField> transfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& interfaceData
// ) const;
// //- Initialise neighbour field transfer
// virtual void initInternalFieldTransfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& internalData
// ) const;
//
// //- Return neighbour field
// virtual tmp<labelField> internalFieldTransfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& internalData
// ) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -322,36 +322,18 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
forAll(patches, patchI)
{
if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI]))
if
(
patches[patchI].coupled()
&& refCast<const coupledPolyPatch>(patches[patchI]).owner()
)
{
const processorPolyPatch& pp =
refCast<const processorPolyPatch>(patches[patchI]);
if (pp.myProcNo() < pp.neighbProcNo())
{
const vectorField::subField faceCentres = pp.faceCentres();
forAll(pp, i)
{
const face& f = pp[i];
const point& fc = faceCentres[i];
forAll(f, fp)
{
globalSum[f[fp]] += fc;
globalNum[f[fp]]++;
}
}
}
}
else if (isA<cyclicPolyPatch>(patches[patchI]))
{
const cyclicPolyPatch& pp =
refCast<const cyclicPolyPatch>(patches[patchI]);
const coupledPolyPatch& pp =
refCast<const coupledPolyPatch>(patches[patchI]);
const vectorField::subField faceCentres = pp.faceCentres();
for (label i = 0; i < pp.size()/2; i++)
forAll(pp, i)
{
const face& f = pp[i];
const point& fc = faceCentres[i];

View File

@ -91,20 +91,6 @@ bool Foam::blockMesh::readPatches
>> patchTypes[nPatches]
>> patchNames[nPatches];
// Read optional neighbour patch name
if (patchTypes[nPatches] == cyclicPolyPatch::typeName)
{
patchStream >> lastToken;
if (lastToken.isWord())
{
nbrPatchNames[nPatches] = lastToken.wordToken();
}
else
{
patchStream.putBack(lastToken);
}
}
// Read patch faces
patchStream >> tmpBlocksPatches[nPatches];
@ -138,57 +124,56 @@ bool Foam::blockMesh::readPatches
if (patchTypes[nPatches-1] == cyclicPolyPatch::typeName)
{
if (nbrPatchNames[nPatches] == word::null)
word halfA = patchNames[nPatches-1] + "_half0";
word halfB = patchNames[nPatches-1] + "_half1";
WarningIn("blockMesh::createTopology(IOdictionary&)")
<< "Old-style cyclic definition."
<< " Splitting patch "
<< patchNames[nPatches-1] << " into two halves "
<< halfA << " and " << halfB << endl
<< " Alternatively use new 'boundary' dictionary syntax."
<< endl;
// Add extra patch
if (tmpBlocksPatches.size() <= nPatches)
{
word halfA = patchNames[nPatches-1] + "_half0";
word halfB = patchNames[nPatches-1] + "_half1";
WarningIn("blockMesh::createTopology(IOdictionary&)")
<< "Old-style cyclic definition."
<< " Splitting patch "
<< patchNames[nPatches-1] << " into two halves "
<< halfA << " and " << halfB << endl
<< " Alternatively use new syntax "
<< " cyclic <name> <neighbourname> <faces>" << endl;
// Add extra patch
if (tmpBlocksPatches.size() <= nPatches)
{
tmpBlocksPatches.setSize(nPatches + 1);
patchNames.setSize(nPatches + 1);
patchTypes.setSize(nPatches + 1);
nbrPatchNames.setSize(nPatches + 1);
}
patchNames[nPatches-1] = halfA;
nbrPatchNames[nPatches-1] = halfB;
patchTypes[nPatches] = patchTypes[nPatches-1];
patchNames[nPatches] = halfB;
nbrPatchNames[nPatches] = halfA;
// Split faces
if ((tmpBlocksPatches[nPatches-1].size() % 2) != 0)
{
FatalErrorIn
(
"blockMesh::createTopology(IOdictionary&)"
) << "Size of cyclic faces is not a multiple of 2 :"
<< tmpBlocksPatches[nPatches-1]
<< exit(FatalError);
}
label sz = tmpBlocksPatches[nPatches-1].size()/2;
faceList unsplitFaces(tmpBlocksPatches[nPatches-1], true);
tmpBlocksPatches[nPatches-1] = faceList
(
SubList<face>(unsplitFaces, sz)
);
tmpBlocksPatches[nPatches] = faceList
(
SubList<face>(unsplitFaces, sz, sz)
);
nPatches++;
tmpBlocksPatches.setSize(nPatches + 1);
patchNames.setSize(nPatches + 1);
patchTypes.setSize(nPatches + 1);
nbrPatchNames.setSize(nPatches + 1);
}
// Update halfA info
patchNames[nPatches-1] = halfA;
nbrPatchNames[nPatches-1] = halfB;
// Update halfB info
patchTypes[nPatches] = patchTypes[nPatches-1];
patchNames[nPatches] = halfB;
nbrPatchNames[nPatches] = halfA;
// Split faces
if ((tmpBlocksPatches[nPatches-1].size() % 2) != 0)
{
FatalErrorIn
(
"blockMesh::createTopology(IOdictionary&)"
) << "Size of cyclic faces is not a multiple of 2 :"
<< tmpBlocksPatches[nPatches-1]
<< exit(FatalError);
}
label sz = tmpBlocksPatches[nPatches-1].size()/2;
faceList unsplitFaces(tmpBlocksPatches[nPatches-1], true);
tmpBlocksPatches[nPatches-1] = faceList
(
SubList<face>(unsplitFaces, sz)
);
tmpBlocksPatches[nPatches] = faceList
(
SubList<face>(unsplitFaces, sz, sz)
);
nPatches++;
}
patchStream >> lastToken;
@ -495,6 +480,29 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
patchPhysicalTypes
);
// Convert into dictionary
PtrList<dictionary> patchDicts(patchNames.size());
forAll(patchDicts, patchI)
{
patchDicts.set(patchI, new dictionary());
patchDicts[patchI].set("name", patchNames[patchI]);
patchDicts[patchI].set("type", patchTypes[patchI]);
if (nbrPatchNames[patchI] != word::null)
{
patchDicts[patchI].set("neighbourPatch", nbrPatchNames[patchI]);
}
if (patchPhysicalTypes[patchI] != word::null)
{
patchDicts[patchI].set
(
"physicalType",
patchPhysicalTypes[patchI]
);
}
}
blockMeshPtr = new polyMesh
(
IOobject
@ -509,11 +517,9 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
xferCopy(blockPointField_), // copy these points, do NOT move
tmpBlockCells,
tmpBlocksPatches,
patchNames,
patchTypes,
patchDicts,
defaultPatchName,
defaultPatchType,
patchPhysicalTypes
defaultPatchType
);
}
else if (meshDescription.found("boundary"))

View File

@ -57,49 +57,6 @@ void Foam::PointEdgeWave<Type>::offset(const label val, labelList& elems)
// - list of halfA points (in cyclic patch points)
// - list of halfB points (can overlap with A!)
// - for every patchPoint its corresponding point
template <class Type>
void Foam::PointEdgeWave<Type>::calcCyclicAddressing()
{
label cycHalf = 0;
forAll(mesh_.boundaryMesh(), patchI)
{
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
if (isA<cyclicPolyPatch>(patch))
{
label halfSize = patch.size()/2;
SubList<face> halfAFaces
(
mesh_.faces(),
halfSize,
patch.start()
);
cycHalves_.set
(
cycHalf++,
new primitivePatch(halfAFaces, mesh_.points())
);
SubList<face> halfBFaces
(
mesh_.faces(),
halfSize,
patch.start() + halfSize
);
cycHalves_.set
(
cycHalf++,
new primitivePatch(halfBFaces, mesh_.points())
);
}
}
}
// Handle leaving domain. Implementation referred to Type
template <class Type>
void Foam::PointEdgeWave<Type>::leaveDomain
@ -559,96 +516,57 @@ void Foam::PointEdgeWave<Type>::handleCyclicPatches()
// 1. Send all point info on cyclic patches. Send as
// face label + offset in face.
label cycHalf = 0;
forAll(mesh_.boundaryMesh(), patchI)
{
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
if (isA<cyclicPolyPatch>(patch))
{
const primitivePatch& halfA = cycHalves_[cycHalf++];
const primitivePatch& halfB = cycHalves_[cycHalf++];
// HalfA : get all changed points in relative addressing
DynamicList<Type> halfAInfo(halfA.nPoints());
DynamicList<label> halfAPoints(halfA.nPoints());
DynamicList<label> halfAOwner(halfA.nPoints());
DynamicList<label> halfAIndex(halfA.nPoints());
getChangedPatchPoints
(
halfA,
halfAInfo,
halfAPoints,
halfAOwner,
halfAIndex
);
// HalfB : get all changed points in relative addressing
DynamicList<Type> halfBInfo(halfB.nPoints());
DynamicList<label> halfBPoints(halfB.nPoints());
DynamicList<label> halfBOwner(halfB.nPoints());
DynamicList<label> halfBIndex(halfB.nPoints());
getChangedPatchPoints
(
halfB,
halfBInfo,
halfBPoints,
halfBOwner,
halfBIndex
);
// HalfA : adapt for leaving domain
leaveDomain(patch, halfA, halfAPoints, halfAInfo);
// HalfB : adapt for leaving domain
leaveDomain(patch, halfB, halfBPoints, halfBInfo);
// Apply rotation for non-parallel planes
const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(patch);
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
DynamicList<Type> nbrInfo(nbrPatch.nPoints());
DynamicList<label> nbrPoints(nbrPatch.nPoints());
DynamicList<label> nbrOwner(nbrPatch.nPoints());
DynamicList<label> nbrIndex(nbrPatch.nPoints());
getChangedPatchPoints
(
nbrPatch,
nbrInfo,
nbrPoints,
nbrOwner,
nbrIndex
);
// nbr : adapt for leaving domain
leaveDomain(nbrPatch, nbrPatch, nbrPoints, nbrInfo);
// Apply rotation for non-parallel planes
if (!cycPatch.parallel())
{
// received data from half1
transform(cycPatch.forwardT(), halfAInfo);
// received data from half2
transform(cycPatch.reverseT(), halfBInfo);
transform(cycPatch.forwardT(), nbrInfo);
}
if (debug)
{
Pout<< "Cyclic patch " << patchI << ' ' << patch.name()
<< " Changed on first half : " << halfAInfo.size()
<< " Changed on second half : " << halfBInfo.size()
<< " Changed : " << nbrInfo.size()
<< endl;
}
// Half1: update with data from halfB
updateFromPatchInfo
(
patch,
halfA,
halfBOwner,
halfBIndex,
halfBInfo
);
// Half2: update with data from halfA
updateFromPatchInfo
(
patch,
halfB,
halfAOwner,
halfAIndex,
halfAInfo
cycPatch,
cycPatch,
nbrOwner,
nbrIndex,
nbrInfo
);
if (debug)
@ -687,7 +605,6 @@ Foam::PointEdgeWave<Type>::PointEdgeWave
changedEdges_(mesh_.nEdges()),
nChangedEdges_(0),
nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
cycHalves_(2*nCyclicPatches_),
nEvals_(0),
nUnvisitedPoints_(mesh_.nPoints()),
nUnvisitedEdges_(mesh_.nEdges())
@ -720,13 +637,6 @@ Foam::PointEdgeWave<Type>::PointEdgeWave
}
// Calculate cyclic halves addressing.
if (nCyclicPatches_ > 0)
{
calcCyclicAddressing();
}
// Set from initial changed points data
setPointInfo(changedPoints, changedPointsInfo);

View File

@ -231,9 +231,6 @@ class PointEdgeWave
//- Merge data from across processor boundaries
void handleProcPatches();
//- Calculate cyclic halves addressing.
void calcCyclicAddressing();
//- Merge data from across cyclic boundaries
void handleCyclicPatches();

View File

@ -210,16 +210,22 @@ void Foam::regionSplit::fillSeedMask
{
const polyPatch& pp = patches[patchI];
if (isA<cyclicPolyPatch>(pp))
if
(
isA<cyclicPolyPatch>(pp)
&& refCast<const cyclicPolyPatch>(pp).owner()
)
{
label faceI = pp.start();
// Transfer from neighbourPatch to here or vice versa.
label halfSz = pp.size()/2;
const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp);
for (label i = 0; i < halfSz; i++)
label faceI = cycPatch.start();
forAll(cycPatch, i)
{
label otherFaceI = refCast<const cyclicPolyPatch>(pp)
.transformGlobalFace(faceI);
label otherFaceI = cycPatch.transformGlobalFace(faceI);
transferCoupledFaceRegion
(

View File

@ -27,8 +27,6 @@ License
#include "cellZoneSet.H"
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "addToRunTimeSelectionTable.H"

View File

@ -27,8 +27,6 @@ License
#include "faceSet.H"
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "syncTools.H"
#include "addToRunTimeSelectionTable.H"
@ -139,105 +137,6 @@ void faceSet::sync(const polyMesh& mesh)
}
}
//const polyBoundaryMesh& patches = mesh.boundaryMesh();
//
//if (Pstream::parRun())
//{
// // Send faces in set that are on a processorPatch. Send as patch face
// // indices.
// forAll(patches, patchI)
// {
// const polyPatch& pp = patches[patchI];
//
// if (isType<processorPolyPatch>(pp))
// {
// const processorPolyPatch& procPatch =
// refCast<const processorPolyPatch>(pp);
//
// // Convert faceSet locally to labelList.
// DynamicList<label> setFaces(pp.size());
//
// forAll(pp, i)
// {
// if (found(pp.start() + i))
// {
// setFaces.append(i);
// }
// }
// setFaces.shrink();
//
// OPstream toNeighbour
// (
// Pstream::blocking,
// procPatch.neighbProcNo()
// );
//
// toNeighbour << setFaces;
// }
// }
//
// // Receive
// forAll(patches, patchI)
// {
// const polyPatch& pp = patches[patchI];
//
// if (isType<processorPolyPatch>(pp))
// {
// const processorPolyPatch& procPatch =
// refCast<const processorPolyPatch>(pp);
//
// IPstream fromNeighbour
// (
// Pstream::blocking,
// procPatch.neighbProcNo()
// );
//
// labelList setFaces(fromNeighbour);
//
// forAll(setFaces, i)
// {
// if (insert(pp.start() + setFaces[i]))
// {
// nAdded++;
// }
// }
// }
// }
//}
//
//// Couple cyclic patches
//forAll (patches, patchI)
//{
// const polyPatch& pp = patches[patchI];
//
// if (typeid(pp) == typeid(cyclicPolyPatch))
// {
// const cyclicPolyPatch& cycPatch =
// refCast<const cyclicPolyPatch>(pp);
//
// forAll (cycPatch, i)
// {
// label thisFaceI = cycPatch.start() + i;
// label otherFaceI = cycPatch.transformGlobalFace(thisFaceI);
//
// if (found(thisFaceI))
// {
// if (insert(otherFaceI))
// {
// nAdded++;
// }
// }
// else if (found(otherFaceI))
// {
// if (insert(thisFaceI))
// {
// nAdded++;
// }
// }
// }
// }
//}
reduce(nAdded, sumOp<label>());
if (nAdded > 0)
{

View File

@ -27,8 +27,6 @@ License
#include "faceZoneSet.H"
#include "mapPolyMesh.H"
#include "polyMesh.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "addToRunTimeSelectionTable.H"

View File

@ -576,16 +576,25 @@ void Foam::scotchDecomp::calcCSR
// Coupled faces. Only cyclics done.
forAll(pbm, patchi)
{
if (isA<cyclicPolyPatch>(pbm[patchi]))
if
(
isA<cyclicPolyPatch>(pbm[patchi])
&& refCast<const cyclicPolyPatch>(pbm[patchi]).owner()
)
{
const unallocLabelList& faceCells = pbm[patchi].faceCells();
const cyclicPolyPatch& cycPatch = refCast<const cyclicPolyPatch>
(
pbm[patchi]
);
label sizeby2 = faceCells.size()/2;
const unallocLabelList& faceCells = cycPatch.faceCells();
const unallocLabelList& nbrCells =
cycPatch.neighbPatch().faceCells();
for (label facei=0; facei<sizeby2; facei++)
forAll(faceCells, facei)
{
label own = faceCells[facei];
label nei = faceCells[facei + sizeby2];
label nei = nbrCells[facei];
adjncy[xadj[own] + nFacesPerCell[own]++] = nei;
adjncy[xadj[nei] + nFacesPerCell[nei]++] = own;

View File

@ -28,7 +28,7 @@ License
#include "fvMesh.H"
#include "cyclicPolyPatch.H"
#include "emptyPolyPatch.H"
#include "processorPolyPatch.H"
#include "coupledPolyPatch.H"
#include "surfaceFields.H"
#include "volFields.H"
#include "IOList.H"
@ -100,9 +100,9 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
{
facePatchId = mesh().boundaryMesh().whichPatch(faceI);
const polyPatch& pp = mesh().boundaryMesh()[facePatchId];
if (isA<processorPolyPatch>(pp))
if (isA<coupledPolyPatch>(pp))
{
if (refCast<const processorPolyPatch>(pp).owner())
if (refCast<const coupledPolyPatch>(pp).owner())
{
faceId = pp.whichFace(faceI);
}
@ -111,18 +111,6 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
faceId = -1;
}
}
else if (isA<cyclicPolyPatch>(pp))
{
label patchFaceI = faceI - pp.start();
if (patchFaceI < pp.size()/2)
{
faceId = patchFaceI;
}
else
{
faceId = -1;
}
}
else if (!isA<emptyPolyPatch>(pp))
{
faceId = faceI - pp.start();