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()
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." 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());
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
virtual void write(Ostream &) const
Write.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
void size(const label n)
Older name for setAddressableSize.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Lookup type of boundary radiation properties.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
bool active() const noexcept
Has the zone been found.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static const char * name(const bool b) noexcept
A string representation of bool as "false" / "true".
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
List of mesh modifiers defining the mesh dynamics.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
virtual Ostream & endBlock()
Write end block group.
Virtual base class for mesh modifiers.
errorManip< error > abort(error &err)
label index() const
The index of the first matching items, -1 if no matches.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
virtual void writeDict(Ostream &) const
Write dictionary.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
virtual bool changeTopology() const
Check for topology change.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
const word & name() const
Return name of this modifier.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
List< label > labelList
A List of labels.
const polyMesh & mesh() const
Return the mesh reference.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.