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];
98 identity(innerSlider.size(), innerSlider.start()),
105 const word outerSliderName
107 motionDict_.
subDict(
"slider").
get<word>(
"outside")
109 const polyPatch& outerSlider =
boundaryMesh()[outerSliderName];
114 identity(outsideSlider.size(), outsideSlider.start()),
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];
134 identity(layerPatch.size(), layerPatch.start()),
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);
368 if (topoChangeMap.valid())
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;