binaryNode.H
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) 2016-2017 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::binaryNode
28
29Description
30 Node of the binary tree
31
32SourceFile
33 binaryNode.C
34
35\*---------------------------------------------------------------------------*/
36
37#ifndef binaryNode_H
38#define binaryNode_H
39
40#include "chemPointISAT.H"
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44namespace Foam
45{
46
47/*---------------------------------------------------------------------------*\
48 Class binaryNode Declaration
49\*---------------------------------------------------------------------------*/
50
51template<class CompType, class ThermoType>
52class binaryNode
53{
54
55public:
56
57 //- Element on the left
59
60 //- Element on the right
62
63 //- Node which follows on the left
65
66 //- Node which follows on the right
68
69 //- Parent node
71
72 //- Number of equations in addition to the species eqs.
73 label nAdditionalEqns_;
77 scalar a_;
78
79 //- Compute vector v:
80 // Let E be the ellipsoid which covers the region of accuracy of
81 // the left leaf (previously defined). E is described by
82 // E={phi| ||L^T.(phi-phi0)|| <= 1}, (see chemPoint for more details).
83 // let E' be the transformation of E in a space where E' is a hypersphere
84 // centered at the origin, in this space y=L^T.(phi-phi0) and then
85 // E'={y| ||y||<=1}
86 // let u be the unit vector joining the center of E' and the newly added
87 // composition point in the transformed space
88 // (y2=L^T.(phiq-phi0)),u = y2/||y2|
89 // Then the hyperplane separating the two points is defined as the
90 // perpendicular bisector of the segment linking 0 to y2
91 // H' = {y| u^T.(y-yh) = 0},
92 // where yh = y2/2.
93 // In the original composition space, the hyperplane H is defined by
94 // H = {y| v^T(phi-phih) = 0},
95 // where phih = phi0 + L^-T.yh = (phi0 + phiq) / 2 and v is
96 // L.L^T (phiq-phi0)
97 // v = -------------------- .
98 // ||L.L^T (phiq-phi0)||
99 //
100 // Note : v is not normalised in this implementation since it is used
101 // on both side of an equality to know if one should go on the
102 // left or the right in the binary tree
103 // Parameter:
104 // elementLeft : chemPoint of the left element
105 // elementRight: chemPoint of the right element
106 // v : empty scalar field to store v
107 // Return: void (v is stored in the empty scalarField)
108 void calcV
109 (
113 );
114
115 //- Compute a the product v^T.phih, with phih = (phi0 + phiq)/2.
116 // When travelling in the binary tree,
117 // to know in which part of the composition space the query point 'phi'
118 // belongs to, v^T.phi is performed. If the result is "> a" then it belongs
119 // to the right part (where phiq is), otherwise it belongs to the left
120 // part (where phi0 is).
121 scalar calcA
122 (
125 );
126
127 // Constructors
128
129 //- Construct null
130 binaryNode();
131
132 //- Construct from components
134 (
138 );
139
140
141 // Member functions
142
143 //- Access
146 {
147 return leafLeft_;
148 }
151 {
152 return leafRight_;
153 }
156 {
157 return nodeLeft_;
158 }
161 {
162 return nodeRight_;
163 }
166 {
167 return parent_;
168 }
169
170 //- Topology
172 inline const scalarField& v() const
173 {
174 return v_;
175 }
177 inline scalarField& v()
178 {
179 return v_;
180 }
182 inline const scalar& a() const
183 {
184 return a_;
185 }
187 inline scalar& a()
188 {
189 return a_;
190 }
191};
192
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196} // End namespace Foam
197
198// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199
200#ifdef NoRepository
201 #include "binaryNode.C"
202#endif
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206#endif
207
208// ************************************************************************* //
Node of the binary tree.
Definition: binaryNode.H:52
scalarField v_
Definition: binaryNode.H:74
binaryNode< CompType, ThermoType > *& nodeLeft()
Definition: binaryNode.H:154
scalarField & v()
Definition: binaryNode.H:176
binaryNode< CompType, ThermoType > *& parent()
Definition: binaryNode.H:164
chemPointISAT< CompType, ThermoType > * leafLeft_
Element on the left.
Definition: binaryNode.H:57
chemPointISAT< CompType, ThermoType > *& leafRight()
Definition: binaryNode.H:149
binaryNode< CompType, ThermoType > *& nodeRight()
Definition: binaryNode.H:159
binaryNode()
Construct null.
Definition: binaryNode.C:33
const scalarField & v() const
Topology.
Definition: binaryNode.H:171
chemPointISAT< CompType, ThermoType > * leafRight_
Element on the right.
Definition: binaryNode.H:60
scalar & a()
Definition: binaryNode.H:186
label nAdditionalEqns_
Number of equations in addition to the species eqs.
Definition: binaryNode.H:72
scalar calcA(chemPointISAT< CompType, ThermoType > *elementLeft, chemPointISAT< CompType, ThermoType > *elementRight)
Compute a the product v^T.phih, with phih = (phi0 + phiq)/2.
Definition: binaryNode.C:164
void calcV(chemPointISAT< CompType, ThermoType > *&elementLeft, chemPointISAT< CompType, ThermoType > *&elementRight, scalarField &v)
Compute vector v:
Definition: binaryNode.C:77
binaryNode< CompType, ThermoType > * parent_
Parent node.
Definition: binaryNode.H:69
binaryNode< CompType, ThermoType > * nodeRight_
Node which follows on the right.
Definition: binaryNode.H:66
chemPointISAT< CompType, ThermoType > *& leafLeft()
Access.
Definition: binaryNode.H:144
const scalar & a() const
Definition: binaryNode.H:181
binaryNode< CompType, ThermoType > * nodeLeft_
Node which follows on the left.
Definition: binaryNode.H:63
Leaf of the binary tree. The chemPoint stores the composition 'phi', the mapping of this composition ...
Namespace for OpenFOAM.