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)
326 ).optionalSubDict(typeName +
"Coeffs")
329 addZonesAndModifiers();
345 Info<<
"Decoupling sliding interfaces" <<
endl;
355 Info<<
"Sliding interfaces decoupled" <<
endl;
363 setMorphTimeIndex(3*time().
timeIndex() + 1);
368 if (topoChangeMap().hasMotionPoints())
370 Info<<
"Topology change; executing pre-motion" <<
endl;
371 movePoints(topoChangeMap().preMotionPoints());
376 movePoints(newPoints());
379 Info<<
"Coupling sliding interfaces" <<
endl;
384 setMorphTimeIndex(3*time().
timeIndex() + 2);
391 Info<<
"Sliding interfaces coupled: " << attached() <<
endl;
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.
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
label size() const noexcept
The number of elements in table.
vectorField pointField
pointField is a vectorField.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
label size() const noexcept
The number of entries 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)
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
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.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
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.