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 {
35  defineTypeNameAndDebug(layeredEngine, 0);
36  addToRunTimeSelectionTable(fvMeshMover, layeredEngine, fvMesh);
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 // ************************************************************************* //
dimensionedScalar pistonDisplacement() const
Return piston displacement for current time step.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
dimensionedScalar pistonSpeed() const
Return piston speed for current time step.
layeredEngine(fvMesh &mesh)
Construct from fvMesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
const Cmpt & z() const
Definition: VectorI.H:87
dimensionedScalar pistonPosition_
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:372
fvMesh & mesh
Macros for easy insertion into run-time selection tables.
const dimensionSet dimLength
defineTypeNameAndDebug(none, 0)
const pointField & points
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
scalar deltaTValue() const
Return time step value.
Definition: TimeStateI.H:34
const Type & value() const
Return const reference to value.
static const char nl
Definition: Ostream.H:260
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Definition: fvMesh.C:1065
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void topoChange(const polyTopoChangeMap &)
Update corresponding to the given map.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Basic mesh motion specifically for engines.
messageStream Info
fvMesh & mesh()
Return the fvMesh.
Definition: fvMeshMover.H:132
volScalarField & p
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
virtual bool update()
Update the mesh for both mesh motion and topology change.
addToRunTimeSelectionTable(fvMeshMover, none, fvMesh)
Namespace for OpenFOAM.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.