54 const scalar& curLeft,
55 const scalar& curRight
58 Info<<
"Updating vertex markup. curLeft: "
59 << curLeft <<
" curRight: " << curRight <<
endl;
61 tmp<scalarField> tvertexMarkup(
new scalarField(p.size()));
66 if (p[pI].x() < curLeft - SMALL)
68 vertexMarkup[pI] = -1;
70 else if (p[pI].x() > curRight + SMALL)
84 void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
93 || topoChanger_.size()
96 Info<<
"void movingConeTopoFvMesh::addZonesAndModifiers() : "
97 <<
"Zones and modifiers already present. Skipping."
103 Info<<
"Time = " << time().timeName() << endl
104 <<
"Adding zones and modifiers to the mesh" <<
endl;
110 boolList flipZone1(fc.size(),
false);
111 label nZoneFaces1 = 0;
114 boolList flipZone2(fc.size(),
false);
115 label nZoneFaces2 = 0;
121 fc[faceI].x() > -0.003501
122 && fc[faceI].x() < -0.003499
125 if ((fa[faceI] &
vector(1, 0, 0)) < 0)
127 flipZone1[nZoneFaces1] =
true;
130 zone1[nZoneFaces1] = faceI;
131 Info<<
"face " << faceI <<
" for zone 1. Flip: "
132 << flipZone1[nZoneFaces1] <<
endl;
137 fc[faceI].x() > -0.00701
138 && fc[faceI].x() < -0.00699
141 zone2[nZoneFaces2] = faceI;
143 if ((fa[faceI] &
vector(1, 0, 0)) > 0)
145 flipZone2[nZoneFaces2] =
true;
148 Info <<
"face " << faceI <<
" for zone 2. Flip: "
149 << flipZone2[nZoneFaces2] <<
endl;
154 zone1.setSize(nZoneFaces1);
155 flipZone1.setSize(nZoneFaces1);
157 zone2.setSize(nZoneFaces2);
158 flipZone2.setSize(nZoneFaces2);
163 List<pointZone*> pz(0);
164 List<faceZone*> fz(2);
165 List<cellZone*> cz(0);
172 "rightExtrusionFaces",
183 "leftExtrusionFaces",
193 Info <<
"Adding mesh zones." <<
endl;
194 addZones(pz, fz, cz);
199 List<polyMeshModifier*> tm(2);
203 new layerAdditionRemoval
208 "rightExtrusionFaces",
211 motionDict_.subDict(
"right").lookup(
"minThickness")
215 motionDict_.subDict(
"right").lookup(
"maxThickness")
220 tm[nMods] =
new layerAdditionRemoval
225 "leftExtrusionFaces",
228 motionDict_.subDict(
"left").lookup(
"minThickness")
232 motionDict_.subDict(
"left").lookup(
"maxThickness")
238 Info <<
"Adding " << nMods <<
" mesh modifiers" <<
endl;
239 topoChanger_.addTopologyModifiers(tm);
248 Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(
const IOobject& io)
263 ).subDict(typeName +
"Coeffs")
265 motionVelAmplitude_(motionDict_.lookup(
"motionVelAmplitude")),
266 motionVelPeriod_(
readScalar(motionDict_.lookup(
"motionVelPeriod"))),
270 Foam::
sin(time().value()*M_PI/motionVelPeriod_)
272 leftEdge_(
readScalar(motionDict_.lookup(
"leftEdge"))),
273 curLeft_(
readScalar(motionDict_.lookup(
"leftObstacleEdge"))),
274 curRight_(
readScalar(motionDict_.lookup(
"rightObstacleEdge")))
277 <<
" Initial curMotionVel_:" << curMotionVel_
280 addZonesAndModifiers();
286 faceZones().findZoneID(
"leftExtrusionFaces")
294 faceZones().findZoneID(
"rightExtrusionFaces")
298 motionMask_ = vertexMarkup
326 Foam::sin(time().value()*M_PI/motionVelPeriod_);
328 Pout<<
"time:" << time().value() <<
" curMotionVel_:" << curMotionVel_
329 <<
" curLeft:" << curLeft_ <<
" curRight:" << curRight_
332 if (topoChangeMap.
valid())
334 Info <<
"Topology change. Calculating motion points" <<
endl;
336 if (topoChangeMap().hasMotionPoints())
338 Info <<
"Topology change. Has premotion points" <<
endl;
385 topoChangeMap().preMotionPoints(),
392 topoChangeMap().preMotionPoints()
394 pos(0.5 -
mag(motionMask_))
395 )*curMotionVel_*time().deltaT().value();
399 Info <<
"Topology change. Already set mesh points" <<
endl;
413 pos(0.5 -
mag(motionMask_))
414 )*curMotionVel_*time().deltaT().value();
419 Info <<
"No topology change" <<
endl;
424 pos(0.5 -
mag(motionMask_))
425 )*curMotionVel_*time().deltaT().value();
429 Info <<
"Executing mesh motion" <<
endl;
430 movePoints(newPoints);
437 faceZones().findZoneID(
"leftExtrusionFaces")
445 faceZones().findZoneID(
"rightExtrusionFaces")