55 void Foam::attachDetach::checkDefinition()
60 || !masterPatchID_.
active()
65 <<
"Not all zones and patches needed in the definition "
66 <<
"have been found. Please check your mesh definition."
74 Pout<<
"Attach/detach object " <<
name() <<
" :" <<
nl
75 <<
" faceZoneID: " << faceZoneID_ <<
nl
76 <<
" masterPatchID: " << masterPatchID_ <<
nl
77 <<
" slavePatchID: " << slavePatchID_ <<
endl;
83 mesh.boundaryMesh()[masterPatchID_.
index()].empty()
84 && mesh.boundaryMesh()[slavePatchID_.
index()].empty()
90 Pout<<
" Attached on construction" <<
endl;
96 if (mesh.faceZones()[faceZoneID_.
index()].empty())
108 DynamicList<label> bouFacesInZone(addr.size());
112 if (!mesh.isInternalFace(addr[facei]))
114 bouFacesInZone.append(addr[facei]);
118 if (bouFacesInZone.size())
121 <<
"Found boundary faces in the zone defining "
122 <<
"attach/detach boundary "
123 <<
" for object " <<
name()
124 <<
" : . This is not allowed." <<
nl
125 <<
"Boundary faces: " << bouFacesInZone
135 Pout<<
" Detached on construction" <<
endl;
145 mesh.boundaryMesh()[masterPatchID_.
index()].size()
146 != mesh.boundaryMesh()[slavePatchID_.
index()].size()
149 mesh.boundaryMesh()[masterPatchID_.
index()].size()
150 != mesh.faceZones()[faceZoneID_.
index()].size()
155 <<
"Problem with sizes in mesh modifier. The face zone,"
156 <<
" master and slave patch should have the same size"
157 <<
" for object " <<
name() <<
". " <<
nl
159 << mesh.faceZones()[faceZoneID_.
index()].size()
160 <<
" Master patch size: "
161 << mesh.boundaryMesh()[masterPatchID_.
index()].size()
162 <<
" Slave patch size: "
163 << mesh.boundaryMesh()[slavePatchID_.
index()].size()
172 DynamicList<label> zoneProblemFaces(addr.size());
177 mesh.boundaryMesh().whichPatch(addr[facei]);
181 facePatch != masterPatchID_.
index()
182 && facePatch != slavePatchID_.
index()
185 zoneProblemFaces.append(addr[facei]);
189 if (zoneProblemFaces.size())
192 <<
"Found faces in the zone defining "
193 <<
"attach/detach boundary which do not belong to "
194 <<
"either master or slave patch. "
195 <<
"This is not allowed." <<
nl
196 <<
"Problem faces: " << zoneProblemFaces
203 bool triggersOK =
true;
205 for (
label i = 0; i < triggerTimes_.
size() - 1; i++)
207 triggersOK = triggersOK && (triggerTimes_[i] < triggerTimes_[i + 1]);
217 <<
"Problem with definition of trigger times: "
224 void Foam::attachDetach::clearAddressing()
const
237 const word& faceZoneName,
238 const word& masterPatchName,
239 const word& slavePatchName,
241 const bool manualTrigger
245 faceZoneID_(faceZoneName, mme.mesh().faceZones()),
246 masterPatchID_(masterPatchName, mme.mesh().boundaryMesh()),
247 slavePatchID_(slavePatchName, mme.mesh().boundaryMesh()),
248 triggerTimes_(triggerTimes),
249 manualTrigger_(manualTrigger),
253 pointMatchMapPtr_(nullptr)
270 dict.lookup(
"faceZoneName"),
271 mme.mesh().faceZones()
275 dict.lookup(
"masterPatchName"),
276 mme.mesh().boundaryMesh()
280 dict.lookup(
"slavePatchName"),
281 mme.mesh().boundaryMesh()
283 triggerTimes_(
dict.lookup(
"triggerTimes")),
284 manualTrigger_(
dict.lookup(
"manualTrigger")),
288 pointMatchMapPtr_(nullptr)
340 Pout<<
"bool attachDetach::changeTopology() const "
341 <<
" for object " <<
name() <<
" : "
342 <<
"Manual trigger" <<
endl;
354 Pout<<
"bool attachDetach::changeTopology() const "
355 <<
" for object " <<
name() <<
" : "
356 <<
"Already triggered for current time step" <<
endl;
364 if (triggerIndex_ >= triggerTimes_.size())
368 Pout<<
"bool attachDetach::changeTopology() const "
369 <<
" for object " <<
name() <<
" : "
370 <<
"Reached end of trigger list" <<
endl;
377 Pout<<
"bool attachDetach::changeTopology() const "
378 <<
" for object " <<
name() <<
" : "
379 <<
"Triggering attach/detach topology change." <<
nl
380 <<
"Current time: " << topoChanger().mesh().time().value()
381 <<
" current trigger time: " << triggerTimes_[triggerIndex_]
382 <<
" trigger index: " << triggerIndex_ <<
endl;
387 if (topoChanger().mesh().time().value() >= triggerTimes_[triggerIndex_])
411 if (state_ == ATTACHED)
413 detachInterface(
ref);
418 else if (state_ == DETACHED)
420 attachInterface(
ref);
428 <<
"Requested attach/detach event and current state "
441 const polyMesh& mesh = topoChanger().mesh();
455 << faceZoneID_.name() <<
nl
456 << masterPatchID_.name() <<
nl
457 << slavePatchID_.name() <<
nl
458 << triggerTimes_ <<
endl;
465 <<
" type " <<
type()
467 <<
" faceZoneName " << faceZoneID_.name()
469 <<
" masterPatchName " << masterPatchID_.name()
471 <<
" slavePatchName " << slavePatchID_.name()
473 <<
" triggerTimes " << triggerTimes_
475 <<
" manualTrigger " << manualTrigger()
477 <<
" active " << active()
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
label index() const
Return index of first matching zone.
bool active() const
Has the zone been found.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
bool empty() const
Return true if the UList is empty (ie, size() is zero)
Attach/detach boundary mesh modifier. This modifier takes a set of internal faces and converts them i...
virtual void write(Ostream &) const
Write.
virtual void topoChange(const polyTopoChangeMap &)
Force recalculation of locally stored data on topological change.
attachDetach(const word &name, const label index, const polyTopoChanger &mme, const word &faceZoneName, const word &masterPatchName, const word &slavePatchName, const scalarField &triggerTimes, const bool manualTrigger=false)
Construct from components.
virtual bool changeTopology() const
Check for topology change.
virtual void writeDict(Ostream &) const
Write dictionary.
virtual ~attachDetach()
Destructor.
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
const Switch & manualTrigger() const
A list of keyword definitions, which are a keyword followed by any number of values (e....
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 meshFaceZones & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
void deleteDemandDrivenData(DataPtr &dataPtr)
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
word name(const complex &)
Return a string representation of a complex.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)