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
29 Engine mesh class for canted valves engine. Layers are added/removed on the
30 piston, while mesh is deformed close to the valves. Attach/detach boundary
31 is used. There are no sliding interfaces.
37 addLayerSmoothMeshModifiers.C
39 layerSmoothCalculate.C
40 layerSmoothInitialize.C
43 \*---------------------------------------------------------------------------*/
48 #include "engineTopoChangerMesh.H"
49 #include "simpleEnginePiston.H"
50 #include "motionSolver.H"
51 #include "polyPatchID.H"
52 #include "verticalValveBank.H"
53 #include "twoDPointCorrector.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 // Class forward declarations
62 /*---------------------------------------------------------------------------*\
63 Class lateralValves Declaration
64 \*---------------------------------------------------------------------------*/
65 class twoDPointCorrector;
69 public engineTopoChangerMesh
74 simpleEnginePiston piston_;
77 verticalValveBank valves_;
79 //- Layering-to-deformation switch in crank-angle degrees
82 //- Tolerance used when the piston faceZone is created
85 //- Distance from the piston patch
89 scalar pistonPosition_;
91 //- Virtual piston position (pistonPosition + offSet)
92 scalar virtualPistonPosition_;
98 autoPtr<motionSolver> msPtr_;
100 //- tolerance for attach/detach in the valve plane
101 scalar valvePlaneTol_;
103 // Private Member Functions
105 //- Disallow default bitwise copy construct
106 layerSmooth(const layerSmooth&);
108 //- Disallow default bitwise assignment
109 void operator=(const layerSmooth&);
111 //- Make layering modifiers live
112 void makeLayersLive();
114 //- Prepare valve attach/detach
117 //- Prepare valve attach/detach
120 //- Prepare valve attach/detach
121 void prepareValveDetach();
123 //- Check if all patches exist, then calculate virtualPistonPosition,
124 //- pistonPosition and deckHeight for the first time
125 void checkAndCalculate();
127 //- Calculate the virtualPistonPosition,
128 void setVirtualPositions();
130 bool realDeformation() const;
132 bool inCantedValve(const point& p, const label& i) const;
134 bool isACylinderHeadFace
136 const labelList& cylHeadFaces,
143 //- Runtime type information
144 TypeName("layerSmooth");
149 //- Construct from database
150 explicit layerSmooth(const IOobject& io);
153 // Destructor - default
158 inline const simpleEnginePiston& piston() const;
159 inline const verticalValveBank& valves() const;
160 inline const scalar& deformSwitch() const;
161 inline const scalar& delta() const;
162 inline const scalar& offSet() const;
163 inline const scalar& pistonPosition() const;
164 inline scalar& pistonPosition();
165 inline const scalar& virtualPistonPosition() const;
166 inline scalar& virtualPistonPosition();
167 inline const scalar& deckHeight() const;
168 inline scalar& deckHeight();
171 //- Return true for mesh deformation mode
172 bool deformation() const
175 engTime().thetaRevolution() > -deformSwitch_
176 && engTime().thetaRevolution() < deformSwitch_;
179 //- Return number of valves
180 label nValves() const
182 return valves_.size();
185 //- Add valve and piston zones and modifiers
186 void addZonesAndModifiers();
189 virtual bool update();
191 //- Set boundary velocities
192 void setBoundaryVelocity(volVectorField& U);
194 //- Generate the mesh from a series of square blocks
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 } // End namespace Foam
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 #include "layerSmoothI.H"
210 // ************************************************************************* //