1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
28 #include "simpleTwoStroke.H"
29 #include "slidingInterface.H"
30 #include "layerAdditionRemoval.H"
31 #include "surfaceFields.H"
32 #include "regionSplit.H"
33 #include "componentMixedTetPolyPatchVectorField.H"
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
37 void Foam::simpleTwoStroke::correctVerticalMotion()
42 void Foam::simpleTwoStroke::calcMovingMasks() const
46 Info<< "void movingSquaresTM::calcMovingMasks() const : "
47 << "Calculating point and cell masks"
51 if (movingPointsMaskPtr_)
53 FatalErrorIn("void movingSquaresTM::calcMovingMasks() const")
54 << "point mask already calculated"
59 movingPointsMaskPtr_ = new scalarField(allPoints().size(), 0);
60 scalarField& movingPointsMask = *movingPointsMaskPtr_;
62 const cellList& c = cells();
63 const faceList& f = allFaces();
65 const labelList& cellAddr =
66 cellZones()[cellZones().findZoneID("movingCells")];
68 forAll (cellAddr, cellI)
70 const cell& curCell = c[cellAddr[cellI]];
72 forAll (curCell, faceI)
74 // Mark all the points as moving
75 const face& curFace = f[curCell[faceI]];
77 forAll (curFace, pointI)
79 movingPointsMask[curFace[pointI]] = 1;
88 const word innerScavZoneName
90 scavInCylPatchName_ + "Zone"
93 const labelList& innerScavAddr =
94 faceZones()[faceZones().findZoneID(innerScavZoneName)];
96 forAll (innerScavAddr, faceI)
98 const face& curFace = f[innerScavAddr[faceI]];
100 forAll (curFace, pointI)
102 movingPointsMask[curFace[pointI]] = 1;
106 const word outerScavZoneName
108 scavInPortPatchName_ + "Zone"
111 const labelList& outerScavAddr =
112 faceZones()[faceZones().findZoneID(outerScavZoneName)];
114 forAll (outerScavAddr, faceI)
116 const face& curFace = f[outerScavAddr[faceI]];
118 forAll (curFace, pointI)
120 movingPointsMask[curFace[pointI]] = 0;
128 // Return moving points mask. Moving points marked with 1
129 const Foam::scalarField& Foam::simpleTwoStroke::movingPointsMask() const
131 if(movingPointsMaskPtr_)
133 movingPointsMaskPtr_ = NULL;
136 if (!movingPointsMaskPtr_)
141 return *movingPointsMaskPtr_;
144 void Foam::simpleTwoStroke::applyMovingMask()