Go to the documentation of this file.
57 void Foam::attachDetach::checkDefinition()
62 || !masterPatchID_.
active()
67 <<
"Not all zones and patches needed in the definition "
68 <<
"have been found. Please check your mesh definition."
76 Pout<<
"Attach/detach object " <<
name() <<
" :" <<
nl
77 <<
" faceZoneID: " << faceZoneID_ <<
nl
78 <<
" masterPatchID: " << masterPatchID_ <<
nl
79 <<
" slavePatchID: " << slavePatchID_ <<
endl;
85 mesh.boundaryMesh()[masterPatchID_.
index()].empty()
86 &&
mesh.boundaryMesh()[slavePatchID_.
index()].empty()
92 Pout<<
" Attached on construction" <<
endl;
98 if (
mesh.faceZones()[faceZoneID_.
index()].empty())
101 <<
"mesh definition."
110 DynamicList<label> bouFacesInZone(addr.size());
114 if (!
mesh.isInternalFace(addr[facei]))
116 bouFacesInZone.append(addr[facei]);
120 if (bouFacesInZone.size())
123 <<
"Found boundary faces in the zone defining "
124 <<
"attach/detach boundary "
125 <<
" for object " <<
name()
126 <<
" : . This is not allowed." <<
nl
127 <<
"Boundary faces: " << bouFacesInZone
137 Pout<<
" Detached on construction" <<
endl;
147 mesh.boundaryMesh()[masterPatchID_.
index()].size()
148 !=
mesh.boundaryMesh()[slavePatchID_.
index()].size()
151 mesh.boundaryMesh()[masterPatchID_.
index()].size()
152 !=
mesh.faceZones()[faceZoneID_.
index()].size()
157 <<
"Problem with sizes in mesh modifier. The face zone,"
158 <<
" master and slave patch should have the same size"
159 <<
" for object " <<
name() <<
". " <<
nl
161 <<
mesh.faceZones()[faceZoneID_.
index()].size()
162 <<
" Master patch size: "
163 <<
mesh.boundaryMesh()[masterPatchID_.
index()].size()
164 <<
" Slave patch size: "
165 <<
mesh.boundaryMesh()[slavePatchID_.
index()].size()
174 DynamicList<label> zoneProblemFaces(addr.size());
179 mesh.boundaryMesh().whichPatch(addr[facei]);
183 facePatch != masterPatchID_.
index()
184 && facePatch != slavePatchID_.
index()
187 zoneProblemFaces.append(addr[facei]);
191 if (zoneProblemFaces.size())
194 <<
"Found faces in the zone defining "
195 <<
"attach/detach boundary which do not belong to "
196 <<
"either master or slave patch. "
197 <<
"This is not allowed." <<
nl
198 <<
"Problem faces: " << zoneProblemFaces
205 bool triggersOK =
true;
207 for (
label i = 0; i < triggerTimes_.size() - 1; i++)
209 triggersOK = triggersOK && (triggerTimes_[i] < triggerTimes_[i + 1]);
219 <<
"Problem with definition of trigger times: "
226 void Foam::attachDetach::clearAddressing()
const
235 Foam::attachDetach::attachDetach
240 const word& faceZoneName,
241 const word& masterPatchName,
242 const word& slavePatchName,
244 const bool manualTrigger
251 triggerTimes_(triggerTimes),
252 manualTrigger_(manualTrigger),
256 pointMatchMapPtr_(
nullptr)
263 Foam::attachDetach::attachDetach
292 pointMatchMapPtr_(
nullptr)
344 Pout<<
"bool attachDetach::changeTopology() const "
345 <<
" for object " <<
name() <<
" : "
346 <<
"Manual trigger" <<
endl;
358 Pout<<
"bool attachDetach::changeTopology() const "
359 <<
" for object " <<
name() <<
" : "
360 <<
"Already triggered for current time step" <<
endl;
368 if (triggerIndex_ >= triggerTimes_.size())
372 Pout<<
"bool attachDetach::changeTopology() const "
373 <<
" for object " <<
name() <<
" : "
374 <<
"Reached end of trigger list" <<
endl;
381 Pout<<
"bool attachDetach::changeTopology() const "
382 <<
" for object " <<
name() <<
" : "
383 <<
"Triggering attach/detach topology change." <<
nl
384 <<
"Current time: " << topoChanger().mesh().time().value()
385 <<
" current trigger time: " << triggerTimes_[triggerIndex_]
386 <<
" trigger index: " << triggerIndex_ <<
endl;
391 if (topoChanger().
mesh().time().value() >= triggerTimes_[triggerIndex_])
415 if (state_ == ATTACHED)
417 detachInterface(
ref);
422 else if (state_ == DETACHED)
424 attachInterface(
ref);
432 <<
"Requested attach/detach event and currect state "
459 << faceZoneID_.name() <<
nl
460 << masterPatchID_.name() <<
nl
461 << slavePatchID_.name() <<
nl
462 << triggerTimes_ <<
endl;
472 os.
writeEntry(
"faceZoneName", faceZoneID_.name());
473 os.
writeEntry(
"masterPatchName", masterPatchID_.name());
474 os.
writeEntry(
"slavePatchName", slavePatchID_.name());
476 os.
writeEntry(
"manualTrigger", manualTrigger());
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.
void deleteDemandDrivenData(DataPtr &dataPtr)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
word name(const complex &c)
Return string representation of complex.
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.
virtual ~attachDetach()
Destructor.
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.
const Switch & manualTrigger() const