1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 #include "simpleTwoStroke.H"
28 #include "slidingInterface.H"
29 #include "layerAdditionRemoval.H"
30 #include "surfaceFields.H"
31 #include "regionSplit.H"
32 #include "componentMixedTetPolyPatchVectorField.H"
34 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
36 void Foam::simpleTwoStroke::correctVerticalMotion()
41 void Foam::simpleTwoStroke::calcMovingMasks() const
45 Info<< "void movingSquaresTM::calcMovingMasks() const : "
46 << "Calculating point and cell masks"
50 if (movingPointsMaskPtr_)
52 FatalErrorIn("void movingSquaresTM::calcMovingMasks() const")
53 << "point mask already calculated"
58 movingPointsMaskPtr_ = new scalarField(allPoints().size(), 0);
59 scalarField& movingPointsMask = *movingPointsMaskPtr_;
61 const cellList& c = cells();
62 const faceList& f = allFaces();
64 const labelList& cellAddr =
65 cellZones()[cellZones().findZoneID("movingCells")];
67 forAll (cellAddr, cellI)
69 const cell& curCell = c[cellAddr[cellI]];
71 forAll (curCell, faceI)
73 // Mark all the points as moving
74 const face& curFace = f[curCell[faceI]];
76 forAll (curFace, pointI)
78 movingPointsMask[curFace[pointI]] = 1;
87 const word innerScavZoneName
89 scavInCylPatchName_ + "Zone"
92 const labelList& innerScavAddr =
93 faceZones()[faceZones().findZoneID(innerScavZoneName)];
95 forAll (innerScavAddr, faceI)
97 const face& curFace = f[innerScavAddr[faceI]];
99 forAll (curFace, pointI)
101 movingPointsMask[curFace[pointI]] = 1;
105 const word outerScavZoneName
107 scavInPortPatchName_ + "Zone"
110 const labelList& outerScavAddr =
111 faceZones()[faceZones().findZoneID(outerScavZoneName)];
113 forAll (outerScavAddr, faceI)
115 const face& curFace = f[outerScavAddr[faceI]];
117 forAll (curFace, pointI)
119 movingPointsMask[curFace[pointI]] = 0;
127 // Return moving points mask. Moving points marked with 1
128 const Foam::scalarField& Foam::simpleTwoStroke::movingPointsMask() const
130 if(movingPointsMaskPtr_)
132 movingPointsMaskPtr_ = NULL;
135 if (!movingPointsMaskPtr_)
140 return *movingPointsMaskPtr_;
143 void Foam::simpleTwoStroke::applyMovingMask()