55 void Foam::attachDetach::checkDefinition()
60 || !masterPatchID_.active()
61 || !slavePatchID_.active()
65 <<
"Not all zones and patches needed in the definition " 66 <<
"have been found. Please check your mesh definition." 70 const polyMesh& mesh = topoChanger().mesh();
74 Pout<<
"Attach/detach object " <<
name() <<
" :" <<
nl 75 <<
" faceZoneID: " << faceZoneID_ <<
nl 76 <<
" masterPatchID: " << masterPatchID_ <<
nl 77 <<
" slavePatchID: " << slavePatchID_ <<
endl;
83 mesh.boundaryMesh()[masterPatchID_.index()].empty()
84 && mesh.boundaryMesh()[slavePatchID_.index()].empty()
90 Pout<<
" Attached on construction" <<
endl;
96 if (mesh.faceZones()[faceZoneID_.index()].empty())
106 const labelList& addr = mesh.faceZones()[faceZoneID_.index()];
108 DynamicList<label> bouFacesInZone(addr.size());
112 if (!mesh.isInternalFace(addr[facei]))
114 bouFacesInZone.append(addr[facei]);
118 if (bouFacesInZone.size())
121 <<
"Found boundary faces in the zone defining " 122 <<
"attach/detach boundary " 123 <<
" for object " <<
name()
124 <<
" : . This is not allowed." <<
nl 125 <<
"Boundary faces: " << bouFacesInZone
135 Pout<<
" Detached on construction" <<
endl;
145 mesh.boundaryMesh()[masterPatchID_.index()].size()
146 != mesh.boundaryMesh()[slavePatchID_.index()].size()
149 mesh.boundaryMesh()[masterPatchID_.index()].size()
150 != mesh.faceZones()[faceZoneID_.index()].size()
155 <<
"Problem with sizes in mesh modifier. The face zone," 156 <<
" master and slave patch should have the same size" 157 <<
" for object " <<
name() <<
". " <<
nl 159 << mesh.faceZones()[faceZoneID_.index()].size()
160 <<
" Master patch size: " 161 << mesh.boundaryMesh()[masterPatchID_.index()].size()
162 <<
" Slave patch size: " 163 << mesh.boundaryMesh()[slavePatchID_.index()].size()
170 const labelList& addr = mesh.faceZones()[faceZoneID_.index()];
172 DynamicList<label> zoneProblemFaces(addr.size());
177 mesh.boundaryMesh().whichPatch(addr[facei]);
181 facePatch != masterPatchID_.index()
182 && facePatch != slavePatchID_.index()
185 zoneProblemFaces.append(addr[facei]);
189 if (zoneProblemFaces.size())
192 <<
"Found faces in the zone defining " 193 <<
"attach/detach boundary which do not belong to " 194 <<
"either master or slave patch. " 195 <<
"This is not allowed." <<
nl 196 <<
"Problem faces: " << zoneProblemFaces
203 bool triggersOK =
true;
205 for (
label i = 0; i < triggerTimes_.size() - 1; i++)
207 triggersOK = triggersOK && (triggerTimes_[i] < triggerTimes_[i + 1]);
213 || (triggerTimes_.empty() && !manualTrigger())
217 <<
"Problem with definition of trigger times: " 224 void Foam::attachDetach::clearAddressing()
const 238 const word& faceZoneName,
239 const word& masterPatchName,
240 const word& slavePatchName,
242 const bool manualTrigger
249 triggerTimes_(triggerTimes),
250 manualTrigger_(manualTrigger),
254 pointMatchMapPtr_(
nullptr)
272 dict.
lookup(
"faceZoneName"),
277 dict.
lookup(
"masterPatchName"),
282 dict.
lookup(
"slavePatchName"),
285 triggerTimes_(dict.
lookup(
"triggerTimes")),
286 manualTrigger_(dict.
lookup(
"manualTrigger")),
290 pointMatchMapPtr_(
nullptr)
342 Pout<<
"bool attachDetach::changeTopology() const " 343 <<
" for object " <<
name() <<
" : " 344 <<
"Manual trigger" <<
endl;
356 Pout<<
"bool attachDetach::changeTopology() const " 357 <<
" for object " <<
name() <<
" : " 358 <<
"Already triggered for current time step" <<
endl;
366 if (triggerIndex_ >= triggerTimes_.size())
370 Pout<<
"bool attachDetach::changeTopology() const " 371 <<
" for object " <<
name() <<
" : " 372 <<
"Reached end of trigger list" <<
endl;
379 Pout<<
"bool attachDetach::changeTopology() const " 380 <<
" for object " <<
name() <<
" : " 381 <<
"Triggering attach/detach topology change." <<
nl 382 <<
"Current time: " << topoChanger().mesh().time().value()
383 <<
" current trigger time: " << triggerTimes_[triggerIndex_]
384 <<
" trigger index: " << triggerIndex_ <<
endl;
389 if (topoChanger().
mesh().time().value() >= triggerTimes_[triggerIndex_])
413 if (state_ == ATTACHED)
415 detachInterface(ref);
420 else if (state_ == DETACHED)
422 attachInterface(ref);
430 <<
"Requested attach/detach event and current state " 443 const polyMesh& mesh = topoChanger().mesh();
457 << faceZoneID_.name() <<
nl 458 << masterPatchID_.name() <<
nl 459 << slavePatchID_.name() <<
nl 460 << triggerTimes_ <<
endl;
467 <<
" type " <<
type()
469 <<
" faceZoneName " << faceZoneID_.name()
471 <<
" masterPatchName " << masterPatchID_.name()
473 <<
" slavePatchName " << slavePatchID_.name()
475 <<
" triggerTimes " << triggerTimes_
477 <<
" manualTrigger " << manualTrigger()
479 <<
" active " << active()
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual void write(Ostream &) const
Write.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const faceZoneMesh & faceZones() const
Return face zone mesh.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
List of mesh modifiers defining the mesh dynamics.
A class for handling words, derived from string.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
List< label > labelList
A List of labels.
Virtual base class for mesh modifiers.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
virtual void writeDict(Ostream &) const
Write dictionary.
virtual bool changeTopology() const
Check for topology change.
prefixOSstream Pout(cout, "Pout")
Direct mesh changes based on v1.3 polyTopoChange syntax.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Mesh consisting of general polyhedral cells.
const polyMesh & mesh() const
Return the mesh reference.
void deleteDemandDrivenData(DataPtr &dataPtr)
virtual ~attachDetach()
Destructor.
attachDetach(const word &name, const label index, const polyTopoChanger &mme, const word &faceZoneName, const word &masterPatchName, const word &slavePatchName, const scalarField &triggerTimes, const bool manualTrigger=false)
Construct from components.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.