46 linearValveLayersFvMesh,
54 void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
67 <<
"Zones and modifiers already present. Skipping." 74 <<
"Adding zones and modifiers to the mesh" <<
endl;
77 List<pointZone*> pz(1);
78 List<faceZone*> fz(4);
79 List<cellZone*> cz(0);
83 pz[0] =
new pointZone(
"cutPointZone", 0,
pointZones());
89 const word innerSliderName
91 motionDict_.
subDict(
"slider").
get<word>(
"inside")
93 const polyPatch& innerSlider =
boundaryMesh()[innerSliderName];
105 const word outerSliderName
107 motionDict_.
subDict(
"slider").
get<word>(
"outside")
109 const polyPatch& outerSlider =
boundaryMesh()[outerSliderName];
121 fz[2] =
new faceZone(
"cutFaceZone", 2,
faceZones());
124 const word layerPatchName
126 motionDict_.
subDict(
"layer").
get<word>(
"patch")
129 const polyPatch& layerPatch =
boundaryMesh()[layerPatchName];
142 Info<<
"Adding point and face zones" <<
endl;
147 List<polyMeshModifier*> tm(2);
149 tm[0] =
new slidingInterface
154 outerSliderName +
"Zone",
155 innerSliderName +
"Zone",
165 new layerAdditionRemoval
171 motionDict_.
subDict(
"layer").
get<scalar>(
"minThickness"),
172 motionDict_.
subDict(
"layer").
get<scalar>(
"maxThickness")
176 Info<<
"Adding topology modifiers" <<
endl;
177 addTopologyModifiers(tm);
184 void Foam::linearValveLayersFvMesh::makeLayersLive()
186 const polyTopoChanger& topoChanges = topoChanger_;
191 if (isA<layerAdditionRemoval>(topoChanges[modI]))
193 topoChanges[modI].enable();
195 else if (isA<slidingInterface>(topoChanges[modI]))
197 topoChanges[modI].disable();
202 <<
"Don't know what to do with mesh modifier " 203 << modI <<
" of type " << topoChanges[modI].type()
210 void Foam::linearValveLayersFvMesh::makeSlidersLive()
212 const polyTopoChanger& topoChanges = topoChanger_;
217 if (isA<layerAdditionRemoval>(topoChanges[modI]))
219 topoChanges[modI].disable();
221 else if (isA<slidingInterface>(topoChanges[modI]))
223 topoChanges[modI].enable();
228 <<
"Don't know what to do with mesh modifier " 229 << modI <<
" of type " << topoChanges[modI].type()
236 bool Foam::linearValveLayersFvMesh::attached()
const 238 const polyTopoChanger& topoChanges = topoChanger_;
244 if (isA<slidingInterface>(topoChanges[modI]))
248 || refCast<const slidingInterface>(topoChanges[modI]).attached();
255 if (isA<slidingInterface>(topoChanges[modI]))
260 != refCast<const slidingInterface>(topoChanges[modI]).attached()
264 <<
"Slider " << modI <<
" named " 265 << topoChanges[modI].name()
266 <<
" out of sync: Should be" << result
278 tmp<pointField> tnewPoints
285 const word layerPatchName
287 motionDict_.subDict(
"layer").get<word>(
"patch")
290 const polyPatch& layerPatch = boundaryMesh()[layerPatchName];
292 const labelList& patchPoints = layerPatch.meshPoints();
296 motionDict_.get<
vector>(
"pistonVelocity")
301 np[patchPoints[ppI]] += vel*time().deltaTValue();
312 Foam::linearValveLayersFvMesh::linearValveLayersFvMesh(
const IOobject&
io)
328 ).optionalSubDict(typeName +
"Coeffs")
331 addZonesAndModifiers();
347 Info<<
"Decoupling sliding interfaces" <<
endl;
357 Info<<
"Sliding interfaces decoupled" <<
endl;
365 setMorphTimeIndex(3*time().
timeIndex() + 1);
370 if (topoChangeMap().hasMotionPoints())
372 Info<<
"Topology change; executing pre-motion" <<
endl;
373 movePoints(topoChangeMap().preMotionPoints());
378 movePoints(newPoints());
381 Info<<
"Coupling sliding interfaces" <<
endl;
386 setMorphTimeIndex(3*time().
timeIndex() + 2);
393 Info<<
"Sliding interfaces coupled: " << attached() <<
endl;
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual bool update()
Update the mesh for both mesh motion and topology change.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const noexcept
The number of elements in table.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const Time & time() const
Return the top-level database.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Macros for easy insertion into run-time selection tables.
virtual ~linearValveLayersFvMesh()
Destructor.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
label size() const noexcept
The number of elements in the list.
void addZones(PtrList< pointZone > &&pz, PtrList< faceZone > &&fz, PtrList< cellZone > &&cz)
Add mesh zones.
Abstract base class for a topology changing fvMesh.
errorManip< error > abort(error &err)
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< label > labelList
A List of labels.
A class for managing temporary objects.
polyTopoChanger topoChanger_
Defines the attributes of an object for which implicit objectRegistry management is supported...
#define InfoInFunction
Report an information message using Foam::Info.