Go to the documentation of this file.
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
246 triggerTimes_(triggerTimes),
249 manualTrigger_(manualTrigger),
251 pointMatchMapPtr_(
nullptr)
257 Foam::attachDetach::attachDetach
284 manualTrigger_(
dict.
get<
bool>(
"manualTrigger")),
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."
430 << faceZoneID_.name() <<
nl
431 << masterPatchID_.name() <<
nl
432 << slavePatchID_.name() <<
nl
433 << triggerTimes_ <<
endl;
443 os.
writeEntry(
"faceZoneName", faceZoneID_.name());
444 os.
writeEntry(
"masterPatchName", masterPatchID_.name());
445 os.
writeEntry(
"slavePatchName", slavePatchID_.name());
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
List< label > labelList
A List of labels.
A class for handling words, derived from Foam::string.
virtual bool changeTopology() const
Check for topology change.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
virtual void writeDict(Ostream &) const
Write dictionary.
List of mesh modifiers defining the mesh dynamics.
Direct mesh changes based on v1.3 polyTopoChange syntax.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
virtual void write(Ostream &) const
Write.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
word name(const complex &c)
Return string representation of complex.
static const char * name(const bool b) noexcept
A string representation of bool as "false" / "true".
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
virtual Ostream & endBlock()
Write end block group.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
Virtual base class for mesh modifiers.
const word & name() const
Return name of this modifier.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const polyMesh & mesh() const
Return the mesh reference.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
defineTypeNameAndDebug(combustionModel, 0)
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
bool active() const
Has the zone been found.
label index() const
Return index of first matching zone.