47 void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
59 Info<<
"void linearValveLayersFvMesh::addZonesAndModifiers() : "
60 <<
"Zones and modifiers already present. Skipping."
67 <<
"Adding zones and modifiers to the mesh" <<
endl;
70 List<pointZone*> pz(1);
71 List<faceZone*> fz(4);
72 List<cellZone*> cz(0);
89 const word innerSliderName(motionDict_.
subDict(
"slider").
lookup(
"inside"));
90 const polyPatch& innerSlider =
97 isf[i] = innerSlider.start() + i;
104 boolList(innerSlider.size(),
false),
110 const word outerSliderName(motionDict_.
subDict(
"slider").
lookup(
"outside"));
111 const polyPatch& outerSlider =
118 osf[i] = outerSlider.start() + i;
125 boolList(outerSlider.size(),
false),
141 const word layerPatchName
146 const polyPatch& layerPatch =
153 lpf[i] = layerPatch.start() + i;
166 Info <<
"Adding point and face zones" <<
endl;
171 List<polyMeshModifier*> tm(2);
173 tm[0] =
new slidingInterface
178 outerSliderName +
"Zone",
179 innerSliderName +
"Zone",
189 new layerAdditionRemoval
206 Info <<
"Adding topology modifiers" <<
endl;
207 addTopologyModifiers(tm);
214 void Foam::linearValveLayersFvMesh::makeLayersLive()
216 const polyTopoChanger& topoChanges = topoChanger_;
219 forAll (topoChanges, modI)
221 if (isA<layerAdditionRemoval>(topoChanges[modI]))
223 topoChanges[modI].enable();
225 else if (isA<slidingInterface>(topoChanges[modI]))
227 topoChanges[modI].disable();
231 FatalErrorIn(
"void linearValveLayersFvMesh::makeLayersLive()")
232 <<
"Don't know what to do with mesh modifier "
233 << modI <<
" of type " << topoChanges[modI].type()
240 void Foam::linearValveLayersFvMesh::makeSlidersLive()
242 const polyTopoChanger& topoChanges = topoChanger_;
245 forAll (topoChanges, modI)
247 if (isA<layerAdditionRemoval>(topoChanges[modI]))
249 topoChanges[modI].disable();
251 else if (isA<slidingInterface>(topoChanges[modI]))
253 topoChanges[modI].enable();
257 FatalErrorIn(
"void linearValveLayersFvMesh::makeLayersLive()")
258 <<
"Don't know what to do with mesh modifier "
259 << modI <<
" of type " << topoChanges[modI].type()
266 bool Foam::linearValveLayersFvMesh::attached()
const
268 const polyTopoChanger& topoChanges = topoChanger_;
272 forAll (topoChanges, modI)
274 if (isA<slidingInterface>(topoChanges[modI]))
278 || refCast<const slidingInterface>(topoChanges[modI]).attached();
283 forAll (topoChanges, modI)
285 if (isA<slidingInterface>(topoChanges[modI]))
290 != refCast<const slidingInterface>(topoChanges[modI]).attached()
293 FatalErrorIn(
"bool linearValveLayersFvMesh::attached() const")
294 <<
"Slider " << modI <<
" named "
295 << topoChanges[modI].name()
296 <<
" out of sync: Should be" << result
308 tmp<pointField> tnewPoints
315 const word layerPatchName
317 motionDict_.subDict(
"layer").lookup(
"patch")
320 const polyPatch& layerPatch =
321 boundaryMesh()[boundaryMesh().findPatchID(layerPatchName)];
323 const labelList& patchPoints = layerPatch.meshPoints();
327 motionDict_.lookup(
"pistonVelocity")
332 np[patchPoints[ppI]] += vel*time().deltaT().value();
343 Foam::linearValveLayersFvMesh::linearValveLayersFvMesh(
const IOobject& io)
358 ).subDict(typeName +
"Coeffs")
361 addZonesAndModifiers();
377 Info <<
"Decoupling sliding interfaces" <<
endl;
387 Info <<
"Sliding interfaces decoupled" <<
endl;
395 setMorphTimeIndex(3*time().
timeIndex() + 1);
398 if (topoChangeMap.valid())
400 if (topoChangeMap().hasMotionPoints())
402 Info <<
"Topology change; executing pre-motion" <<
endl;
403 movePoints(topoChangeMap().preMotionPoints());
408 movePoints(newPoints());
411 Info <<
"Coupling sliding interfaces" <<
endl;
416 setMorphTimeIndex(3*time().
timeIndex() + 2);
419 Info <<
"Moving points post slider attach" <<
endl;
423 Info <<
"Sliding interfaces coupled: " << attached() <<
endl;