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