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 237 const word& faceZoneName,
238 const word& masterPatchName,
239 const word& slavePatchName,
241 const bool manualTrigger
248 triggerTimes_(triggerTimes),
249 manualTrigger_(manualTrigger),
253 pointMatchMapPtr_(
nullptr)
270 dict.
lookup(
"faceZoneName"),
275 dict.
lookup(
"masterPatchName"),
280 dict.
lookup(
"slavePatchName"),
283 triggerTimes_(dict.
lookup(
"triggerTimes")),
284 manualTrigger_(dict.
lookup(
"manualTrigger")),
288 pointMatchMapPtr_(
nullptr)
340 Pout<<
"bool attachDetach::changeTopology() const " 341 <<
" for object " <<
name() <<
" : " 342 <<
"Manual trigger" <<
endl;
354 Pout<<
"bool attachDetach::changeTopology() const " 355 <<
" for object " <<
name() <<
" : " 356 <<
"Already triggered for current time step" <<
endl;
364 if (triggerIndex_ >= triggerTimes_.size())
368 Pout<<
"bool attachDetach::changeTopology() const " 369 <<
" for object " <<
name() <<
" : " 370 <<
"Reached end of trigger list" <<
endl;
377 Pout<<
"bool attachDetach::changeTopology() const " 378 <<
" for object " <<
name() <<
" : " 379 <<
"Triggering attach/detach topology change." <<
nl 380 <<
"Current time: " << topoChanger().mesh().time().value()
381 <<
" current trigger time: " << triggerTimes_[triggerIndex_]
382 <<
" trigger index: " << triggerIndex_ <<
endl;
387 if (topoChanger().
mesh().time().value() >= triggerTimes_[triggerIndex_])
411 if (state_ == ATTACHED)
413 detachInterface(ref);
418 else if (state_ == DETACHED)
420 attachInterface(ref);
428 <<
"Requested attach/detach event and current state " 441 const polyMesh& mesh = topoChanger().mesh();
455 << faceZoneID_.name() <<
nl 456 << masterPatchID_.name() <<
nl 457 << slavePatchID_.name() <<
nl 458 << triggerTimes_ <<
endl;
465 <<
" type " <<
type()
467 <<
" faceZoneName " << faceZoneID_.name()
469 <<
" masterPatchName " << masterPatchID_.name()
471 <<
" slavePatchName " << slavePatchID_.name()
473 <<
" triggerTimes " << triggerTimes_
475 <<
" manualTrigger " << manualTrigger()
477 <<
" 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.
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")
const meshFaceZones & faceZones() const
Return face zones.
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.