Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
engine
engineMesh
engineMesh
engineMesh.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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
26
#include "
engineMesh.H
"
27
#include <
OpenFOAM/dimensionedScalar.H
>
28
29
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30
31
defineTypeNameAndDebug
(
Foam::engineMesh
, 0);
32
33
defineRunTimeSelectionTable
(
Foam::engineMesh
, IOobject);
34
35
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36
37
Foam::engineMesh::engineMesh(
const
IOobject
& io)
38
:
39
fvMesh
(io),
40
engineDB_(
refCast
<const
engineTime
>(time())),
41
pistonIndex_(-1),
42
linerIndex_(-1),
43
cylinderHeadIndex_(-1),
44
deckHeight_(
"deckHeight"
,
dimLength
, GREAT),
45
pistonPosition_(
"pistonPosition"
,
dimLength
, -GREAT)
46
{
47
bool
foundPiston =
false
;
48
bool
foundLiner =
false
;
49
bool
foundCylinderHead =
false
;
50
51
forAll
(
boundary
(), i)
52
{
53
if
(
boundary
()[i].
name
() ==
"piston"
)
54
{
55
pistonIndex_
= i;
56
foundPiston =
true
;
57
}
58
else
if
(
boundary
()[i].
name
() ==
"liner"
)
59
{
60
linerIndex_
= i;
61
foundLiner =
true
;
62
}
63
else
if
(
boundary
()[i].
name
() ==
"cylinderHead"
)
64
{
65
cylinderHeadIndex_
= i;
66
foundCylinderHead =
true
;
67
}
68
}
69
70
reduce
(foundPiston,
orOp<bool>
());
71
reduce
(foundLiner,
orOp<bool>
());
72
reduce
(foundCylinderHead,
orOp<bool>
());
73
74
if
(!foundPiston)
75
{
76
FatalErrorIn
(
"engineMesh::engineMesh(const IOobject& io)"
)
77
<<
"cannot find piston patch"
78
<<
exit
(
FatalError
);
79
}
80
81
if
(!foundLiner)
82
{
83
FatalErrorIn
(
"engineMesh::engineMesh(const IOobject& io)"
)
84
<<
"cannot find liner patch"
85
<<
exit
(
FatalError
);
86
}
87
88
if
(!foundCylinderHead)
89
{
90
FatalErrorIn
(
"engineMesh::engineMesh(const IOobject& io)"
)
91
<<
"cannot find cylinderHead patch"
92
<<
exit
(
FatalError
);
93
}
94
95
{
96
if
(
pistonIndex_
!= -1)
97
{
98
pistonPosition_
.
value
() = -GREAT;
99
if
(
boundary
()[
pistonIndex_
].patch().localPoints().
size
())
100
{
101
pistonPosition_
.
value
() =
102
max
(
boundary
()[
pistonIndex_
].patch().localPoints()).z();
103
}
104
}
105
reduce
(
pistonPosition_
.
value
(),
maxOp<scalar>
());
106
107
if
(
cylinderHeadIndex_
!= -1)
108
{
109
deckHeight_
.
value
() = GREAT;
110
if
(
boundary
()[
cylinderHeadIndex_
].patch().localPoints().
size
())
111
{
112
deckHeight_
.
value
() =
min
113
(
114
boundary
()[
cylinderHeadIndex_
].patch().localPoints()
115
).z();
116
}
117
}
118
reduce
(
deckHeight_
.
value
(),
minOp<scalar>
());
119
120
Info
<<
"deckHeight: "
<<
deckHeight_
.
value
() <<
nl
121
<<
"piston position: "
<<
pistonPosition_
.
value
() <<
endl
;
122
}
123
}
124
125
126
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
127
128
Foam::engineMesh::~engineMesh
()
129
{}
130
131
// ************************ vim: set sw=4 sts=4 et: ************************ //