53void 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;
88 Pout<<
" Attached on construction" <<
endl;
106 DynamicList<label> bouFacesInZone(addr.size());
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;
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
158 <<
" Master patch size: "
160 <<
" Slave patch size: "
170 DynamicList<label> zoneProblemFaces(addr.size());
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: "
222void Foam::attachDetach::clearAddressing()
const
224 pointMatchMapPtr_.reset(
nullptr);
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)
269 mme.
mesh().faceZones()
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;
444 os.
writeEntry(
"masterPatchName", masterPatchID_.name());
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
label index() const
The index of the first matching items, -1 if no matches.
bool active() const noexcept
Has the zone been found.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
void size(const label n)
Older name for setAddressableSize.
bool empty() const noexcept
True if the list is empty (ie, size() is zero)
label size() const noexcept
The number of elements in the list.
Attach/detach boundary mesh modifier. This modifier takes a set of internal faces and converts them i...
virtual bool changeTopology() const
Check for topology change.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
virtual bool write()
Write the output fields.
Foam::dictionary writeDict() const
Write to dictionary.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void updateMesh()
Update for new mesh topology.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Virtual base class for mesh modifiers.
const word & name() const
Return name of this modifier.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
Mesh consisting of general polyhedral cells.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Direct mesh changes based on v1.3 polyTopoChange syntax.
List of mesh modifiers defining the mesh dynamics.
const polyMesh & mesh() const
Return the mesh reference.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
Lookup type of boundary radiation properties.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
List< label > labelList
A List of labels.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.