53 void Foam::attachDetach::checkDefinition()
58 || !masterPatchID_.
active()
63 <<
"Not all zones and patches needed in the definition "
64 <<
"have been found. Please check your mesh definition."
72 Pout<<
"Attach/detach object " <<
name() <<
" :" <<
nl
73 <<
" faceZoneID: " << faceZoneID_ <<
nl
74 <<
" masterPatchID: " << masterPatchID_ <<
nl
75 <<
" slavePatchID: " << slavePatchID_ <<
endl;
81 mesh.boundaryMesh()[masterPatchID_.
index()].empty()
82 &&
mesh.boundaryMesh()[slavePatchID_.
index()].empty()
88 Pout<<
" Attached on construction" <<
endl;
94 if (
mesh.faceZones()[faceZoneID_.
index()].empty())
106 DynamicList<label> bouFacesInZone(addr.size());
110 if (!
mesh.isInternalFace(addr[facei]))
112 bouFacesInZone.append(addr[facei]);
116 if (bouFacesInZone.size())
119 <<
"Found boundary faces in the zone defining "
120 <<
"attach/detach boundary "
121 <<
" for object " <<
name()
122 <<
" : . This is not allowed." <<
nl
123 <<
"Boundary faces: " << bouFacesInZone
133 Pout<<
" Detached on construction" <<
endl;
143 mesh.boundaryMesh()[masterPatchID_.
index()].size()
144 !=
mesh.boundaryMesh()[slavePatchID_.
index()].size()
147 mesh.boundaryMesh()[masterPatchID_.
index()].size()
148 !=
mesh.faceZones()[faceZoneID_.
index()].size()
153 <<
"Problem with sizes in mesh modifier. The face zone,"
154 <<
" master and slave patch should have the same size"
155 <<
" for object " <<
name() <<
". " <<
nl
157 <<
mesh.faceZones()[faceZoneID_.
index()].size()
158 <<
" Master patch size: "
159 <<
mesh.boundaryMesh()[masterPatchID_.
index()].size()
160 <<
" Slave patch size: "
161 <<
mesh.boundaryMesh()[slavePatchID_.
index()].size()
170 DynamicList<label> zoneProblemFaces(addr.size());
175 mesh.boundaryMesh().whichPatch(addr[facei]);
179 facePatch != masterPatchID_.
index()
180 && facePatch != slavePatchID_.
index()
183 zoneProblemFaces.append(addr[facei]);
187 if (zoneProblemFaces.size())
190 <<
"Found faces in the zone defining "
191 <<
"attach/detach boundary which do not belong to "
192 <<
"either master or slave patch. "
193 <<
"This is not allowed." <<
nl
194 <<
"Problem faces: " << zoneProblemFaces
201 bool triggersOK =
true;
203 for (label i = 0; i < triggerTimes_.size() - 1; i++)
205 triggersOK = triggersOK && (triggerTimes_[i] < triggerTimes_[i + 1]);
211 || (triggerTimes_.empty() && !manualTrigger_)
215 <<
"Problem with definition of trigger times: "
222 void Foam::attachDetach::clearAddressing()
const
224 pointMatchMapPtr_.reset(
nullptr);
230 Foam::attachDetach::attachDetach
235 const word& faceZoneName,
236 const word& masterPatchName,
237 const word& slavePatchName,
239 const bool manualTrigger
243 faceZoneID_(faceZoneName, mme.
mesh().faceZones()),
246 triggerTimes_(triggerTimes),
249 manualTrigger_(manualTrigger),
251 pointMatchMapPtr_(nullptr)
257 Foam::attachDetach::attachDetach
269 mme.
mesh().faceZones()
286 pointMatchMapPtr_(nullptr)
296 trigger_ = (!attached());
304 trigger_ = (attached());
316 Pout<<
"bool attachDetach::changeTopology() const "
317 <<
" for object " <<
name() <<
" : "
318 <<
"Manual trigger" <<
endl;
330 Pout<<
"bool attachDetach::changeTopology() const "
331 <<
" for object " <<
name() <<
" : "
332 <<
"Already triggered for current time step" <<
endl;
340 if (triggerIndex_ >= triggerTimes_.size())
344 Pout<<
"bool attachDetach::changeTopology() const "
345 <<
" for object " <<
name() <<
" : "
346 <<
"Reached end of trigger list" <<
endl;
353 Pout<<
"bool attachDetach::changeTopology() const "
354 <<
" for object " <<
name() <<
" : "
355 <<
"Triggering attach/detach topology change." <<
nl
356 <<
"Current time: " << topoChanger().mesh().time().value()
357 <<
" current trigger time: " << triggerTimes_[triggerIndex_]
358 <<
" trigger index: " << triggerIndex_ <<
endl;
363 if (topoChanger().
mesh().time().value() >= triggerTimes_[triggerIndex_])
387 if (state_ == ATTACHED)
389 detachInterface(
ref);
394 else if (state_ == DETACHED)
396 attachInterface(
ref);
404 <<
"Requested attach/detach event. Current state is unknown."
416 const polyMesh&
mesh = topoChanger().mesh();
430 << faceZoneID_.name() <<
nl
431 << masterPatchID_.name() <<
nl
432 << slavePatchID_.name() <<
nl
433 << triggerTimes_ <<
endl;
444 os.
writeEntry(
"masterPatchName", masterPatchID_.name());