43 linearValveLayersFvMesh,
51 void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
60 || topoChanger_.size()
64 <<
"Zones and modifiers already present. Skipping." 70 Info<<
"Time = " << time().timeName() << endl
71 <<
"Adding zones and modifiers to the mesh" <<
endl;
74 List<pointZone*> pz(1);
75 List<faceZone*> fz(4);
76 List<cellZone*> cz(0);
93 const word innerSliderName(motionDict_.subDict(
"slider").lookup(
"inside"));
94 const polyPatch& innerSlider = boundaryMesh()[innerSliderName];
100 isf[i] = innerSlider.start() + i;
107 boolList(innerSlider.size(),
false),
113 const word outerSliderName(motionDict_.subDict(
"slider").lookup(
"outside"));
114 const polyPatch& outerSlider = boundaryMesh()[outerSliderName];
120 osf[i] = outerSlider.start() + i;
127 boolList(outerSlider.size(),
false),
143 const word layerPatchName
145 motionDict_.subDict(
"layer").lookup(
"patch")
148 const polyPatch& layerPatch = boundaryMesh()[layerPatchName];
154 lpf[i] = layerPatch.start() + i;
167 Info<<
"Adding point and face zones" <<
endl;
168 addZones(pz, fz, cz);
172 List<polyMeshModifier*> tm(2);
174 tm[0] =
new slidingInterface
179 outerSliderName +
"Zone",
180 innerSliderName +
"Zone",
190 new layerAdditionRemoval
196 motionDict_.subDict(
"layer").lookup<scalar>(
"minThickness"),
197 motionDict_.subDict(
"layer").lookup<scalar>(
"maxThickness")
201 Info<<
"Adding topology modifiers" <<
endl;
202 addTopologyModifiers(tm);
209 void Foam::linearValveLayersFvMesh::makeLayersLive()
211 const polyTopoChanger& topoChanges = topoChanger_;
216 if (isA<layerAdditionRemoval>(topoChanges[modI]))
218 topoChanges[modI].enable();
220 else if (isA<slidingInterface>(topoChanges[modI]))
222 topoChanges[modI].disable();
227 <<
"Don't know what to do with mesh modifier " 228 << modI <<
" of type " << topoChanges[modI].type()
235 void Foam::linearValveLayersFvMesh::makeSlidersLive()
237 const polyTopoChanger& topoChanges = topoChanger_;
242 if (isA<layerAdditionRemoval>(topoChanges[modI]))
244 topoChanges[modI].disable();
246 else if (isA<slidingInterface>(topoChanges[modI]))
248 topoChanges[modI].enable();
253 <<
"Don't know what to do with mesh modifier " 254 << modI <<
" of type " << topoChanges[modI].type()
261 bool Foam::linearValveLayersFvMesh::attached()
const 263 const polyTopoChanger& topoChanges = topoChanger_;
269 if (isA<slidingInterface>(topoChanges[modI]))
273 || refCast<const slidingInterface>(topoChanges[modI]).attached();
280 if (isA<slidingInterface>(topoChanges[modI]))
285 != refCast<const slidingInterface>(topoChanges[modI]).attached()
289 <<
"Slider " << modI <<
" named " 290 << topoChanges[modI].name()
291 <<
" out of sync: Should be" << result
303 tmp<pointField> tnewPoints
310 const word layerPatchName
312 motionDict_.subDict(
"layer").lookup(
"patch")
315 const polyPatch& layerPatch = boundaryMesh()[layerPatchName];
317 const labelList& patchPoints = layerPatch.meshPoints();
321 motionDict_.lookup(
"pistonVelocity")
326 np[patchPoints[ppI]] += vel*time().deltaTValue();
339 motionDict_(dynamicMeshDict().optionalSubDict(typeName +
"Coeffs"))
341 addZonesAndModifiers();
357 Info<<
"Decoupling sliding interfaces" <<
endl;
367 Info<<
"Sliding interfaces decoupled" <<
endl;
378 if (topoChangeMap.valid())
380 if (topoChangeMap().hasMotionPoints())
382 Info<<
"Topology change; executing pre-motion" <<
endl;
383 movePoints(topoChangeMap().preMotionPoints());
391 Info<<
"Coupling sliding interfaces" <<
endl;
403 Info<<
"Sliding interfaces coupled: " << attached() <<
endl;
virtual bool update()
Update the mesh for both mesh motion and topology change.
#define forAll(list, i)
Loop across all elements in list.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool movePoints()
Do what is necessary if the mesh has moved.
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 ~linearValveLayersFvMesh()
Destructor.
List< bool > boolList
Bool container classes.
vectorField pointField
pointField is a vectorField.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
Abstract base class for a topology changing fvMesh.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
linearValveLayersFvMesh(const IOobject &io)
Construct from database.
A class for managing temporary objects.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define InfoInFunction
Report an information message using Foam::Info.