fvMeshMoversLayeredEngine.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace fvMeshMovers
34 {
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 :
45  engine(mesh),
46  pistonLayers_("pistonLayers", dimLength, meshCoeffs_)
47 {}
48 
49 
50 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
51 
53 {}
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
59 {
60  const scalar deltaZ = pistonDisplacement().value();
61  Info<< "deltaZ = " << deltaZ << endl;
62 
63  // Position of the top of the static mesh layers above the piston
64  const scalar pistonPlusLayers =
65  pistonPosition_.value() + pistonLayers_.value();
66 
67  pointField newPoints(mesh().points());
68 
69  forAll(newPoints, pointi)
70  {
71  point& p = newPoints[pointi];
72 
73  if (p.z() < pistonPlusLayers) // In piston bowl
74  {
75  p.z() += deltaZ;
76  }
77  else if (p.z() < deckHeight_.value()) // In liner region
78  {
79  p.z() +=
80  deltaZ
81  *(deckHeight_.value() - p.z())
82  /(deckHeight_.value() - pistonPlusLayers);
83  }
84  }
85 
86  mesh().movePoints(newPoints);
87 
88  pistonPosition_.value() += deltaZ;
89  const scalar pistonSpeed = deltaZ/mesh().time().deltaTValue();
90 
91  Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
92  << "Piston speed = " << pistonSpeed << " m/s" << endl;
93 
94  return true;
95 }
96 
97 
99 {
101 }
102 
103 
105 {}
106 
107 
109 (
110  const polyDistributionMap&
111 )
112 {
114 }
115 
116 
117 // ************************************************************************* //
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Macros for easy insertion into run-time selection tables.
Abstract base class for fvMesh movers.
Definition: fvMeshMover.H:53
Basic mesh motion specifically for engines.
layeredEngine(fvMesh &mesh)
Construct from fvMesh.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool update()
Update the mesh for both mesh motion and topology change.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
const pointField & points
defineTypeNameAndDebug(none, 0)
addToRunTimeSelectionTable(fvMeshMover, none, fvMesh)
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
messageStream Info
const dimensionSet dimLength
static const char nl
Definition: Ostream.H:260
volScalarField & p