70 Info<<
"Updating vertex markup. curLeft: " 71 << curLeft <<
" curRight: " << curRight <<
endl;
74 auto& vertexMarkup = tvertexMarkup.ref();
78 if (
p[pI].
x() < curLeft - SMALL)
80 vertexMarkup[pI] = -1;
82 else if (
p[pI].
x() > curRight + SMALL)
96 void Foam::movingConeTopoFvMesh::addZonesAndModifiers()
103 || faceZones().size()
104 || cellZones().size()
105 || topoChanger_.size()
109 <<
"Zones and modifiers already present. Skipping." 115 Info<<
"Time = " << time().timeName() <<
endl 116 <<
"Adding zones and modifiers to the mesh" <<
endl;
122 boolList flipZone1(fc.size(),
false);
123 label nZoneFaces1 = 0;
126 boolList flipZone2(fc.size(),
false);
127 label nZoneFaces2 = 0;
133 fc[facei].
x() > -0.003501
134 && fc[facei].
x() < -0.003499
137 if ((fa[facei] &
vector(1, 0, 0)) < 0)
139 flipZone1[nZoneFaces1] =
true;
142 zone1[nZoneFaces1] = facei;
143 Info<<
"face " << facei <<
" for zone 1. Flip: " 144 << flipZone1[nZoneFaces1] <<
endl;
149 fc[facei].
x() > -0.00701
150 && fc[facei].
x() < -0.00699
153 zone2[nZoneFaces2] = facei;
155 if ((fa[facei] &
vector(1, 0, 0)) > 0)
157 flipZone2[nZoneFaces2] =
true;
160 Info<<
"face " << facei <<
" for zone 2. Flip: " 161 << flipZone2[nZoneFaces2] <<
endl;
166 zone1.setSize(nZoneFaces1);
167 flipZone1.setSize(nZoneFaces1);
169 zone2.setSize(nZoneFaces2);
170 flipZone2.setSize(nZoneFaces2);
175 List<pointZone*> pz(0);
176 List<faceZone*> fz(2);
177 List<cellZone*> cz(0);
184 "rightExtrusionFaces",
186 std::move(flipZone1),
195 "leftExtrusionFaces",
197 std::move(flipZone2),
205 Info<<
"Adding mesh zones." <<
endl;
206 addZones(pz, fz, cz);
211 List<polyMeshModifier*> tm(2);
215 new layerAdditionRemoval
220 "rightExtrusionFaces",
221 motionDict_.subDict(
"right").get<scalar>(
"minThickness"),
222 motionDict_.subDict(
"right").get<scalar>(
"maxThickness")
226 tm[nMods] =
new layerAdditionRemoval
231 "leftExtrusionFaces",
232 motionDict_.subDict(
"left").get<scalar>(
"minThickness"),
233 motionDict_.subDict(
"left").get<scalar>(
"maxThickness")
238 Info<<
"Adding " << nMods <<
" mesh modifiers" <<
endl;
239 topoChanger_.addTopologyModifiers(tm);
247 Foam::movingConeTopoFvMesh::movingConeTopoFvMesh
265 ).optionalSubDict(typeName +
"Coeffs")
282 motionVelAmplitude_ = motionDict_.get<
vector>(
"motionVelAmplitude");
283 motionVelPeriod_ = motionDict_.get<scalar>(
"motionVelPeriod");
285 motionVelAmplitude_*
sin(time().value()*
pi/motionVelPeriod_);
286 leftEdge_ = motionDict_.get<scalar>(
"leftEdge");
287 curLeft_ = motionDict_.get<scalar>(
"leftObstacleEdge");
288 curRight_ = motionDict_.get<scalar>(
"rightObstacleEdge");
290 Pout<<
"Initial time:" << time().value()
291 <<
" Initial curMotionVel_:" << curMotionVel_
294 addZonesAndModifiers();
300 faceZones().findZoneID(
"leftExtrusionFaces")
308 faceZones().findZoneID(
"rightExtrusionFaces")
312 motionMask_ = vertexMarkup
342 motionVelAmplitude_*
sin(time().value()*
pi/motionVelPeriod_);
344 Pout<<
"time:" << time().value() <<
" curMotionVel_:" << curMotionVel_
345 <<
" curLeft:" << curLeft_ <<
" curRight:" << curRight_
350 Info<<
"Topology change. Calculating motion points" <<
endl;
352 if (topoChangeMap().hasMotionPoints())
354 Info<<
"Topology change. Has premotion points" <<
endl;
359 topoChangeMap().preMotionPoints(),
366 topoChangeMap().preMotionPoints()
369 )*curMotionVel_*time().deltaTValue();
373 Info<<
"Topology change. Already set mesh points" <<
endl;
388 )*curMotionVel_*time().deltaTValue();
393 Info<<
"No topology change" <<
endl;
399 )*curMotionVel_*time().deltaTValue();
403 Info <<
"Executing mesh motion" <<
endl;
404 movePoints(newPoints);
412 faceZones().findZoneID(
"leftExtrusionFaces")
420 faceZones().findZoneID(
"rightExtrusionFaces")
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
virtual bool update()
Update the mesh for both mesh motion and topology change.
Macros for easy insertion into run-time selection tables.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
vectorField pointField
pointField is a vectorField.
Abstract base class for a topology changing fvMesh.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
constexpr scalar pi(M_PI)
dimensionedScalar pos0(const dimensionedScalar &ds)
dimensionedScalar sin(const dimensionedScalar &ds)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
defineTypeNameAndDebug(combustionModel, 0)
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
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.
virtual ~movingConeTopoFvMesh()
Destructor.
Defines the attributes of an object for which implicit objectRegistry management is supported...
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
#define InfoInFunction
Report an information message using Foam::Info.