41 namespace fvMeshTopoChangers
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::fvMeshTopoChangers::movingCone::addZonesAndModifiers()
90 mesh().pointZones().size()
91 ||
mesh().faceZones().size()
92 ||
mesh().cellZones().size()
93 || topoChanger_.size()
97 <<
"Zones and modifiers already present. Skipping." 103 Info<<
"Time = " <<
mesh().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 mesh().addZones(pz, fz, cz);
199 List<polyMeshModifier*> tm(2);
203 new layerAdditionRemoval
208 "rightExtrusionFaces",
209 motionDict_.subDict(
"right").lookup<scalar>(
"minThickness"),
210 motionDict_.subDict(
"right").lookup<scalar>(
"maxThickness")
214 tm[nMods] =
new layerAdditionRemoval
219 "leftExtrusionFaces",
220 motionDict_.subDict(
"left").lookup<scalar>(
"minThickness"),
221 motionDict_.subDict(
"left").lookup<scalar>(
"maxThickness")
226 Info<<
"Adding " << nMods <<
" mesh modifiers" <<
endl;
227 topoChanger_.addTopologyModifiers(tm);
244 motionVelAmplitude_(motionDict_.lookup(
"motionVelAmplitude")),
245 motionVelPeriod_(motionDict_.lookup<scalar>(
"motionVelPeriod")),
250 leftEdge_(motionDict_.lookup<scalar>(
"leftEdge")),
251 curLeft_(motionDict_.lookup<scalar>(
"leftObstacleEdge")),
252 curRight_(motionDict_.lookup<scalar>(
"rightObstacleEdge"))
255 <<
" Initial curMotionVel_:" << curMotionVel_
258 addZonesAndModifiers();
276 motionMask_ = vertexMarkup
303 motionVelAmplitude_*
sin(
mesh().time().value()*
pi/motionVelPeriod_);
305 Pout<<
"time:" <<
mesh().time().value()
306 <<
" curMotionVel_:" << curMotionVel_
307 <<
" curLeft:" << curLeft_
308 <<
" curRight:" << curRight_
311 if (topoChangeMap.
valid())
313 Info<<
"Topology change. Calculating motion points" <<
endl;
315 if (topoChangeMap().hasMotionPoints())
317 Info<<
"Topology change. Has premotion points" <<
endl;
322 topoChangeMap().preMotionPoints(),
329 topoChangeMap().preMotionPoints()
332 )*curMotionVel_*
mesh().time().deltaT().value();
336 Info<<
"Topology change. Already set mesh points" <<
endl;
351 )*curMotionVel_*
mesh().time().deltaT().value();
356 Info<<
"No topology change" <<
endl;
362 )*curMotionVel_*
mesh().time().deltaT().value();
366 Info <<
"Executing mesh motion" <<
endl;
367 mesh().movePoints(newPoints);
375 mesh().faceZones().findZoneID(
"leftExtrusionFaces")
383 mesh().faceZones().findZoneID(
"rightExtrusionFaces")
label findZoneID(const word &zoneName) const
Find zone index given a name.
#define forAll(list, i)
Loop across all elements in list.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
A list of keyword definitions, which are a keyword followed by any number of values (e...
virtual bool update()
Update the mesh for both mesh motion and topology change.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Vector< scalar > vector
A scalar version of the templated Vector.
const Time & time() const
Return the top-level database.
Macros for easy insertion into run-time selection tables.
virtual const pointField & points() const
Return raw points.
List< bool > boolList
Bool container classes.
vectorField pointField
pointField is a vectorField.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
movingCone(fvMesh &mesh, const dictionary &dict)
Construct from fvMesh and dictionary.
const Type & value() const
Return const reference to value.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
List< label > labelList
A List of labels.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set)
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedScalar sin(const dimensionedScalar &ds)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
const meshFaceZones & faceZones() const
Return face zones.
Mesh data needed to do the Finite Volume discretisation.
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A class for managing temporary objects.
Class containing mesh-to-mesh mapping information.
virtual ~movingCone()
Destructor.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Abstract base class for fvMesh movers.
#define InfoInFunction
Report an information message using Foam::Info.