enginePiston.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2013 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "enginePiston.H"
29 #include "engineTime.H"
30 #include "polyMesh.H"
31 #include "interpolateXY.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 Foam::enginePiston::enginePiston
36 (
37  const polyMesh& mesh,
38  const word& pistonPatchName,
39  const autoPtr<coordinateSystem>& pistonCS,
40  const scalar minLayer,
41  const scalar maxLayer
42 )
43 :
44  mesh_(mesh),
45  engineDB_(refCast<const engineTime>(mesh.time())),
46  patchID_(pistonPatchName, mesh.boundaryMesh()),
47  csysPtr_(pistonCS),
48  minLayer_(minLayer),
49  maxLayer_(maxLayer)
50 {}
51 
52 
53 Foam::enginePiston::enginePiston
54 (
55  const polyMesh& mesh,
56  const dictionary& dict
57 )
58 :
59  mesh_(mesh),
60  engineDB_(refCast<const engineTime>(mesh_.time())),
61  patchID_(dict.lookup("patch"), mesh.boundaryMesh()),
62  csysPtr_
63  (
64  coordinateSystem::New(mesh_, dict, coordinateSystem::typeName)
65  ),
66  minLayer_(dict.get<scalar>("minLayer")),
67  maxLayer_(dict.get<scalar>("maxLayer"))
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
74 {
75  os << nl;
76  os.beginBlock();
77  os.writeEntry("patch", patchID_.name());
78  os.writeEntry("minLayer", minLayer_);
79  os.writeEntry("maxLayer", maxLayer_);
80  os.endBlock();
81 }
82 
83 
84 // ************************************************************************* //
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
Base class for coordinate system specification, the default coordinate system type is cartesian ...
dictionary dict
const wordRe & name() const noexcept
The selector name.
Definition: DynamicID.H:123
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
Type & refCast(U &obj)
A dynamic_cast (for references). Generates a FatalError on failed casts and uses the virtual type() m...
Definition: typeInfo.H:159
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Definition: boundaryMesh.H:58
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
Lookup type of boundary radiation properties.
Definition: lookup.H:57
An abstract class for the time description of the piston motion.
Definition: engineTime.H:50
dynamicFvMesh & mesh
A class for handling words, derived from Foam::string.
Definition: word.H:63
Interpolates y values from one curve to another with a different x distribution.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
void writeDict(Ostream &) const
Write dictionary.
Definition: enginePiston.C:66
OBJstream os(runTime.globalPath()/outputName)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74