Documentation 6b54b78464
Loading...
Searching...
No Matches
CLookUpTable.hpp
Go to the documentation of this file.
1/*!
2 * \file CLookupTable.hpp
3 * \brief tabulation of fluid properties
4 * \author D. Mayer, T. Economon
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28#pragma once
29
30#include <array>
31#include <iomanip>
32#include <string>
33#include <vector>
34
35#include "../../Common/include/option_structure.hpp"
36#include "CFileReaderLUT.hpp"
37#include "CTrapezoidalMap.hpp"
38
39/*!
40 * \brief Look up table.
41 * \ingroup LookUpInterp
42 */
44 protected:
45 int rank; /*!< \brief MPI Rank. */
46
47 std::string file_name_lut, /*!< \brief LUT file name.*/
48 version_lut, /*!< \brief LUT version as specified in LUT file.*/
49 version_reader, /*!< \brief Reader version (should be equal or above LUT version).*/
50 name_CV1, /*!< \brief Name of controlling variable 1.*/
51 name_CV2; /*!< \brief Name of controlling variable 2.*/
52
53 unsigned long idx_CV1, /*!< \brief Table variable index of controlling variable 1.*/
54 idx_CV2, /*!< \brief Table variable index of controlling variable 2.*/
55 idx_null; /*!< \brief Variable index corresponding to NULL variable. */
56
57 su2vector<unsigned long> n_points, /*!< \brief Number of data poins per table level.*/
58 n_triangles, /*!< \brief Number of triangles per table level.*/
59 n_hull_points; /*!< \brief Number of outer boundary points per table level.*/
60
61 unsigned long n_variables, n_table_levels = 1;
62
63 std::vector<su2double> z_values_levels; /*!< \brief Constant z-values of each table level.*/
64
65 unsigned short table_dim = 2; /*!< \brief Table dimension.*/
66 /*!
67 * \brief The lower and upper limits of the z, y and x variable for each table level.
68 */
69 std::pair<su2double*, su2double*> limits_table_z;
71
72 /*! \brief Holds the variable names stored in the table file.
73 * Order is in sync with data.
74 */
76
77 /*! \brief
78 * Holds all data stored in the table. First index addresses the variable
79 * while second index addresses the point.
80 */
82
83 double memory_footprint_data = 0; /*!< \brief Memory footprint of the loaded table data. */
84
85 /*! \brief
86 * Holds all connectivity data stored in the table for each level. First index
87 * addresses the variable while second index addresses the point.
88 */
90
91 /*! \brief
92 * Edge information for each table level.
93 */
96
97 /*! \brief
98 * The hull contains the boundary of the lookup table.
99 */
101
102 /*! \brief
103 * Trapezoidal map objects for the table levels.
104 */
106
107 /*! \brief
108 * Vector of all the weight factors for the interpolation.
109 */
111
112 /*! \brief
113 * Returns true if the string is null or zero (ignores case).
114 */
115 inline bool noSource(const std::string& name_var) const {
116 if (name_var.compare("NULL") == 0 || name_var.compare("Null") == 0 || name_var.compare("null") == 0 ||
117 name_var.compare("ZERO") == 0 || name_var.compare("Zero") == 0 || name_var.compare("zero") == 0) {
118 return true;
119 } else {
120 return false;
121 }
122 }
123
124 /*!
125 * \brief Get the pointer to the column data of the table (density, temperature, source terms, ...).
126 * \returns Pointer to the column data.
127 */
128 inline const su2double* GetDataP(const std::string& name_var, unsigned long i_level = 0) const {
129 return table_data[i_level][GetIndexOfVar(name_var)];
130 }
131
132 /*!
133 * \brief Find the table limits, i.e. the minimum and maximum values of the 2 independent
134 * controlling variables. We put the values in the variables.
135 * limits_table_x[2] and limit_table_y[2].
136 * \param[in] name_CV1 - The string name for the first controlling variable.
137 * \param[in] name_CV2 - The string name of the second controlling variable.
138 */
139 void FindTableLimits(const std::string& name_CV1, const std::string& name_CV2);
140
141 /*!
142 * \brief Construct a list of all the edges and a list of the pair of elements left and right of the edge.
143 */
144 void IdentifyUniqueEdges();
145
146 /*!
147 * \brief Read the lookup table from file and store the data.
148 * \param[in] file_name_lut - the filename of the lookup table.
149 */
150 void LoadTableRaw(const std::string& file_name_lut);
151
152 /*!
153 * \brief Compute vector of all (inverse) interpolation coefficients "interp_mat_inv_x_y" of all triangles.
154 */
155 void ComputeInterpCoeffs();
156
157 /*!
158 * \brief Compute the inverse matrix for interpolation.
159 * \param[in] vec_CV1 - Pointer to first coordinate (progress variable).
160 * \param[in] vec_CV2 - Pointer to second coordinate (enthalpy).
161 * \param[in] point_ids - Single triangle data.
162 * \param[out] interp_mat_inv - Inverse matrix for interpolation.
163 */
164 void GetInterpMatInv(const su2double* vec_CV1, const su2double* vec_CV2, std::array<unsigned long, 3>& point_ids,
165 su2activematrix& interp_mat_inv);
166
167 /*!
168 * \brief Compute the interpolation coefficients for the triangular interpolation.
169 * \param[in] val_CV1 - Value of first coordinate (progress variable).
170 * \param[in] val_CV2 - Value of second coordinate (enthalpy).
171 * \param[in] interp_mat_inv - Inverse matrix for interpolation.
172 * \param[out] interp_coeffs - Interpolation coefficients.
173 */
174 void GetInterpCoeffs(su2double val_CV1, su2double val_CV2, const su2activematrix& interp_mat_inv,
175 std::array<su2double, 3>& interp_coeffs) const;
176
177 /*!
178 * \brief Compute interpolated value of a point P in the triangle.
179 * \param[in] val_samples - Pointer to the variable data.
180 * \param[in] val_triangle - ID to the triangle.
181 * \param[in] val_interp_coeffs - Interpolation coefficients using the point data in P.
182 * \returns Resulting value of the interpolation.
183 */
184 su2double Interpolate(const su2double* val_samples, std::array<unsigned long, 3>& val_triangle,
185 std::array<su2double, 3>& val_interp_coeffs);
186
187 /*!
188 * \brief Perform linear interpolation between two table levels for a single variable.
189 * \param[in] val_CV3 - Value of the third controlling variable at the query point.
190 * \param[in] lower_level - Table level index of the table level directly below the query point.
191 * \param[in] upper_level - Table level index of the table level directly above the query point.
192 * \param[in] lower_value - Result from x-y interpolation on the lower table level.
193 * \param[in] upper_value - Result from x-y interpolation on the upper table level.
194 * \param[in] val_vars - Pointer to interpolation result.
195 */
196 void Linear_Interpolation(const su2double val_CV3, const unsigned long lower_level, const unsigned long upper_level,
197 su2double& lower_value, su2double& upper_value, su2double*& var_vals) const;
198
199 /*!
200 * \brief Perform linear interpolation between two table levels for a vector of variables.
201 * \param[in] val_CV3 - Value of the third controlling variable at the query point.
202 * \param[in] lower_level - Table level index of the table level directly below the query point.
203 * \param[in] upper_level - Table level index of the table level directly above the query point.
204 * \param[in] lower_values - Results from x-y interpolation on the lower table level.
205 * \param[in] upper_values - Results from x-y interpolation on the upper table level.
206 * \param[in] val_vars - Pointer to interpolation results for all interpolation variables.
207 */
208 void Linear_Interpolation(const su2double val_CV3, const unsigned long lower_level, const unsigned long upper_level,
209 std::vector<su2double>& lower_values, std::vector<su2double>& upper_values,
210 std::vector<su2double>& var_vals) const;
211
212 /*!
213 * \brief Find the point on the hull (boundary of the table) that is closest to the point P(val_CV1,val_CV2).
214 * \param[in] val_CV1 - First coordinate of point P(val_CV1,val_CV2) to check.
215 * \param[in] val_CV2 - Second coordinate of point P(val_CV1,val_CV2) to check.
216 * \returns Point id of the nearest neighbor on the hull.
217 */
218 unsigned long FindNearestNeighborOnHull(su2double val_CV1, su2double val_CV2, unsigned long i_level = 0);
219
220 /*!
221 * \brief Interpolate data based on distance-weighted averaging on the nearest two table nodes.
222 * \param[in] val_CV1 - First coordinate of point P(val_CV1,val_CV2) to check.
223 * \param[in] val_CV2 - Second coordinate of point P(val_CV1,val_CV2) to check.
224 * \param[in] val_names_var - Vector of string names of the variables to look up.
225 * \param[out] val_vars - Pointer to the vector of stored values of the variables to look up.
226 */
227 void InterpolateToNearestNeighbors(const su2double val_CV1, const su2double val_CV2,
228 const std::vector<std::string>& names_var, std::vector<su2double*>& var_vals,
229 const unsigned long i_level = 0);
230
231 /*!
232 * \brief Interpolate data based on distance-weighted averaging on the nearest two table nodes.
233 * \param[in] val_CV1 - First coordinate of point P(val_CV1,val_CV2) to check.
234 * \param[in] val_CV2 - Second coordinate of point P(val_CV1,val_CV2) to check.
235 * \param[in] idx_var - Vector of table variable indices to be looked up.
236 * \param[out] val_vars - Pointer to the vector of stored values of the variables to look up.
237 */
238 void InterpolateToNearestNeighbors(const su2double val_CV1, const su2double val_CV2,
239 const std::vector<unsigned long>& idx_var, std::vector<su2double>& var_vals,
240 const unsigned long i_level = 0);
241
242 /*!
243 * \brief Interpolate data based on distance-weighted averaging on the nearest two table nodes.
244 * \param[in] val_CV1 - First coordinate of point P(val_CV1,val_CV2) to check.
245 * \param[in] val_CV2 - Second coordinate of point P(val_CV1,val_CV2) to check.
246 * \param[in] idx_var - Vector of table variable indices to be looked up.
247 * \param[out] val_vars - Pointer to the vector of stored values of the variables to look up.
248 */
249 void InterpolateToNearestNeighbors(const su2double val_CV1, const su2double val_CV2,
250 const std::vector<unsigned long>& idx_var, std::vector<su2double*>& var_vals,
251 const unsigned long i_level = 0);
252
253 /*!
254 * \brief Interpolate data based on distance-weighted averaging on the nearest two table nodes for a single variable.
255 * \param[in] val_CV1 - First coordinate of point P(val_CV1,val_CV2) to check.
256 * \param[in] val_CV2 - Second coordinate of point P(val_CV1,val_CV2) to check.
257 * \param[in] name_var - Variable name to look up.
258 * \param[out] var_val - Pointer to the to be interpolated variable.
259 */
260 void InterpolateToNearestNeighbors(const su2double val_CV1, const su2double val_CV2, const std::string& name_var,
261 su2double* var_val, const unsigned long i_level = 0);
262
263 /*!
264 * \brief Compute the values of the first and second controlling variable based on normalized query coordinates
265 * \param[in] inclusion_levels - Pair containing lower(first) and upper(second) table inclusion level indices.
266 * \param[in] val_CV1 - First controlling variable value.
267 * \param[in] val_CV2 - Second controlling variable value.
268 * \param[in] val_CV3 - Third controlling variable value.
269 * \returns Array with first and second controlling variable values for the upper and lower table inclusion levels.
270 */
271 std::array<std::array<su2double, 2>, 2> ComputeNormalizedXY(std::pair<unsigned long, unsigned long>& inclusion_levels,
272 const su2double val_CV1, const su2double val_CV2,
273 const su2double val_CV3);
274
275 /*!
276 * \brief Find the triangle within which the query point (val_CV1, val_CV2) is located.
277 * \param[in] val_CV1 - First controlling variable value.
278 * \param[in] val_CV2 - Second controlling variable value.
279 * \param[in] id_triangle - Reference to inclusion triangle index.
280 * \param[in] iLevel - Table level index.
281 * \returns if query point is within data set.
282 */
283 bool FindInclusionTriangle(const su2double val_CV1, const su2double val_CV2, unsigned long& id_triangle,
284 const unsigned long iLevel = 0);
285
286 /*!
287 * \brief Identify the nearest second nearest hull nodes w.r.t. the query point (val_CV1, val_CV2).
288 * \param[in] val_CV1 - First controlling variable value.
289 * \param[in] val_CV2 - Second controlling variable value.
290 * \param[in] iLevel - Table level index.
291 * \returns pair with nearest node index(first) and second nearest node(second).
292 */
293 std::pair<unsigned long, unsigned long> FindNearestNeighbors(const su2double val_CV1, const su2double val_CV2,
294 const unsigned long iLevel = 0);
295
296 public:
297 CLookUpTable(const std::string& file_name_lut, std::string name_CV1_in, std::string name_CV2_in);
298
299 /*!
300 * \brief Print information to screen.
301 */
302 void PrintTableInfo();
303
304 /*!
305 * \brief Lookup value of variable stored under idx_var using controlling variable values(val_CV1,val_CV2).
306 * \param[in] idx_var - Column index corresponding to look-up data.
307 * \param[out] val_var - The stored value of the variable to look up.
308 * \param[in] val_CV1 - Value of controlling variable 1.
309 * \param[in] val_CV2 - Value of controlling variable 2.
310 * \returns whether query is inside (true) or outside (false) data set.
311 */
312 bool LookUp_XY(const unsigned long idx_var, su2double* val_var, const su2double val_CV1, const su2double val_CV2,
313 const unsigned long i_level = 0);
314
315 /*!
316 * \brief Lookup the value of the variable stored under idx_var using controlling variable values(val_CV1,val_CV2).
317 * \param[in] idx_var - Table data column indices corresponding to look-up variables.
318 * \param[out] val_var - The stored value of the variable to look up.
319 * \param[in] val_CV1 - Value of controlling variable 1.
320 * \param[in] val_CV2 - Value of controlling variable 2.
321 * \returns whether query is inside (true) or outside (false) data set.
322 */
323 bool LookUp_XY(const std::vector<unsigned long>& idx_var, std::vector<su2double>& val_vars, const su2double val_CV1,
324 const su2double val_CV2, const unsigned long i_level = 0);
325
326 /*!
327 * \brief Lookup the values of the variables stored under idx_var using controlling variable values(val_CV1,val_CV2).
328 * \param[in] idx_var - Table data column indices corresponding to look-up variables.
329 * \param[out] val_var - The stored value of the variable to look up.
330 * \param[in] val_CV1 - Value of controlling variable 1.
331 * \param[in] val_CV2 - Value of controlling variable 2.
332 * \returns whether query is inside (true) or outside (false) data set.
333 */
334 bool LookUp_XY(const std::vector<unsigned long>& idx_var, std::vector<su2double*>& val_vars, const su2double val_CV1,
335 su2double val_CV2, const unsigned long i_level = 0);
336 /*!
337 * \brief Lookup the value of the variable stored under idx_var using controlling variable values(val_CV1,val_CV2,
338 * val_CV3). \param[in] val_name_var - String name of the variable to look up. \param[out] val_var - The stored value
339 * of the variable to look up. \param[in] val_CV1 - Value of controlling variable 1. \param[in] val_CV2 - Value of
340 * controlling variable 2. \param[in] val_CV3 - Value of controlling variable 3. \returns whether query is inside
341 * (true) or outside (false) data set.
342 */
343 bool LookUp_XYZ(const unsigned long idx_var, su2double* val_var, const su2double val_CV1, const su2double val_CV2,
344 const su2double val_CV3);
345
346 /*!
347 * \brief Lookup the values of the variables stored under idx_var using controlling variable values
348 * (val_CV1,val_CV2,val_z). \param[in] idx_var - Table variable index to look up. \param[out] val_var - The stored
349 * value of the variable to look up. \param[in] val_CV1 - Value of controlling variable 1. \param[in] val_CV2 - Value
350 * of controlling variable 2. \param[in] val_CV3 - Value of controlling variable 3. \returns whether query is inside
351 * (true) or outside (false) data set.
352 */
353 bool LookUp_XYZ(const std::vector<unsigned long>& idx_var, std::vector<su2double>& val_vars, const su2double val_CV1,
354 const su2double val_CV2, const su2double val_CV3 = 0);
355
356 /*!
357 * \brief Lookup the values of the variables stored under idx_var using controlling variable values
358 * (val_CV1,val_CV2,val_z). \param[in] idx_var - Table variable index to look up. \param[out] val_var - The stored
359 * value of the variable to look up. \param[in] val_CV1 - Value of controlling variable 1. \param[in] val_CV2 - Value
360 * of controlling variable 2. \param[in] val_CV3 - Value of controlling variable 3. \returns whether query is inside
361 * (true) or outside (false) data set.
362 */
363 bool LookUp_XYZ(const std::vector<unsigned long>& idx_var, std::vector<su2double*>& val_vars, const su2double val_CV1,
364 const su2double val_CV2, const su2double val_CV3 = 0);
365
366 /*!
367 * \brief Find the table levels with constant z-values directly above and below query val_z.
368 * \param[in] val_CV3 - Value of controlling variable 3.
369 * \returns Pair of inclusion level indices (first = lower level index, second = upper level index).
370 */
371 std::pair<unsigned long, unsigned long> FindInclusionLevels(const su2double val_CV3);
372
373 /*!
374 * \brief Determine the minimum and maximum value of the second controlling variable.
375 * \returns Pair of minimum and maximum value of controlling variable 2.
376 */
377 inline std::pair<su2double*, su2double*> GetTableLimitsY(const unsigned long i_level = 0) const {
378 return limits_table_y[i_level];
379 }
380
381 /*!
382 * \brief Determine the minimum and maximum value of the first controlling variable.
383 * \returns Pair of minimum and maximum value of controlling variable 1.
384 */
385 inline std::pair<su2double*, su2double*> GetTableLimitsX(const unsigned long i_level = 0) const {
386 return limits_table_x[i_level];
387 }
388
389 /*!
390 * \brief Check whether requested set of variables are included in the table.
391 */
392 bool CheckForVariables(const std::vector<std::string>& vars_to_check) const;
393
394 /*!
395 * \brief Returns the index to the variable in the lookup table.
396 * \param[in] nameVar - Variable name for which to retrieve the column index.
397 * \returns Table data column index corresponding to variable.
398 */
399 inline unsigned int GetIndexOfVar(const std::string& nameVar) const {
400 int index = find(names_var.begin(), names_var.end(), nameVar) - names_var.begin();
401 if (index == int(names_var.size())) {
402 index = -1;
403 std::string error_msg = "Variable '";
404 error_msg.append(nameVar);
405 error_msg.append("' is not in the lookup table.");
407 }
408 return index;
409 }
410
411 /*! \brief
412 * Returns the table variable index which will always return zero when looked up.
413 */
414 unsigned long GetNullIndex() const { return idx_null; }
415};
reading lookup table for tabulated fluid properties
Memory-efficient trapezoidal map for 2D lookup table queries, based on the LUT implementation of P....
A templated matrix/vector-like object.
Definition C2DContainer.hpp:374
static void Error(const std::string &ErrorMsg, const std::string &FunctionName)
Definition mpi_structure.cpp:131
Look up table.
Definition CLookUpTable.hpp:43
std::pair< unsigned long, unsigned long > FindNearestNeighbors(const su2double val_CV1, const su2double val_CV2, const unsigned long iLevel=0)
Identify the nearest second nearest hull nodes w.r.t. the query point (val_CV1, val_CV2).
Definition CLookUpTable.cpp:640
su2vector< unsigned long > n_points
Number of data poins per table level.
Definition CLookUpTable.hpp:57
su2vector< std::pair< su2double *, su2double * > > limits_table_x
Definition CLookUpTable.hpp:70
std::pair< su2double *, su2double * > GetTableLimitsY(const unsigned long i_level=0) const
Determine the minimum and maximum value of the second controlling variable.
Definition CLookUpTable.hpp:377
unsigned long n_table_levels
Definition CLookUpTable.hpp:61
std::array< std::array< su2double, 2 >, 2 > ComputeNormalizedXY(std::pair< unsigned long, unsigned long > &inclusion_levels, const su2double val_CV1, const su2double val_CV2, const su2double val_CV3)
Compute the values of the first and second controlling variable based on normalized query coordinates...
Definition CLookUpTable.cpp:516
std::pair< unsigned long, unsigned long > FindInclusionLevels(const su2double val_CV3)
Find the table levels with constant z-values directly above and below query val_z.
Definition CLookUpTable.cpp:399
su2vector< su2vector< std::vector< unsigned long > > > edge_to_triangle
Definition CLookUpTable.hpp:95
su2vector< su2matrix< unsigned long > > triangles
Holds all connectivity data stored in the table for each level. First index addresses the variable wh...
Definition CLookUpTable.hpp:89
bool FindInclusionTriangle(const su2double val_CV1, const su2double val_CV2, unsigned long &id_triangle, const unsigned long iLevel=0)
Find the triangle within which the query point (val_CV1, val_CV2) is located.
Definition CLookUpTable.cpp:607
su2vector< unsigned long > n_triangles
Number of triangles per table level.
Definition CLookUpTable.hpp:58
std::string name_CV1
Name of controlling variable 1.
Definition CLookUpTable.hpp:50
bool noSource(const std::string &name_var) const
Returns true if the string is null or zero (ignores case).
Definition CLookUpTable.hpp:115
unsigned int GetIndexOfVar(const std::string &nameVar) const
Returns the index to the variable in the lookup table.
Definition CLookUpTable.hpp:399
std::pair< su2double *, su2double * > GetTableLimitsX(const unsigned long i_level=0) const
Determine the minimum and maximum value of the first controlling variable.
Definition CLookUpTable.hpp:385
void GetInterpCoeffs(su2double val_CV1, su2double val_CV2, const su2activematrix &interp_mat_inv, std::array< su2double, 3 > &interp_coeffs) const
Compute the interpolation coefficients for the triangular interpolation.
Definition CLookUpTable.cpp:613
su2vector< CTrapezoidalMap > trap_map_x_y
Trapezoidal map objects for the table levels.
Definition CLookUpTable.hpp:105
void GetInterpMatInv(const su2double *vec_CV1, const su2double *vec_CV2, std::array< unsigned long, 3 > &point_ids, su2activematrix &interp_mat_inv)
Compute the inverse matrix for interpolation.
Definition CLookUpTable.cpp:375
bool LookUp_XY(const std::vector< unsigned long > &idx_var, std::vector< su2double * > &val_vars, const su2double val_CV1, su2double val_CV2, const unsigned long i_level=0)
Lookup the values of the variables stored under idx_var using controlling variable values(val_CV1,...
std::vector< su2double > z_values_levels
Constant z-values of each table level.
Definition CLookUpTable.hpp:63
void Linear_Interpolation(const su2double val_CV3, const unsigned long lower_level, const unsigned long upper_level, su2double &lower_value, su2double &upper_value, su2double *&var_vals) const
Perform linear interpolation between two table levels for a single variable.
Definition CLookUpTable.cpp:480
bool LookUp_XYZ(const unsigned long idx_var, su2double *val_var, const su2double val_CV1, const su2double val_CV2, const su2double val_CV3)
Lookup the value of the variable stored under idx_var using controlling variable values(val_CV1,...
Definition CLookUpTable.cpp:424
unsigned long GetNullIndex() const
Returns the table variable index which will always return zero when looked up.
Definition CLookUpTable.hpp:414
void InterpolateToNearestNeighbors(const su2double val_CV1, const su2double val_CV2, const std::vector< std::string > &names_var, std::vector< su2double * > &var_vals, const unsigned long i_level=0)
Interpolate data based on distance-weighted averaging on the nearest two table nodes.
Definition CLookUpTable.cpp:740
void FindTableLimits(const std::string &name_CV1, const std::string &name_CV2)
Find the table limits, i.e. the minimum and maximum values of the 2 independent controlling variables...
Definition CLookUpTable.cpp:156
bool LookUp_XY(const std::vector< unsigned long > &idx_var, std::vector< su2double > &val_vars, const su2double val_CV1, const su2double val_CV2, const unsigned long i_level=0)
Lookup the value of the variable stored under idx_var using controlling variable values(val_CV1,...
std::string version_lut
LUT version as specified in LUT file.
Definition CLookUpTable.hpp:48
su2double Interpolate(const su2double *val_samples, std::array< unsigned long, 3 > &val_triangle, std::array< su2double, 3 > &val_interp_coeffs)
Compute interpolated value of a point P in the triangle.
Definition CLookUpTable.cpp:627
bool CheckForVariables(const std::vector< std::string > &vars_to_check) const
Check whether requested set of variables are included in the table.
Definition CLookUpTable.cpp:765
su2vector< std::pair< su2double *, su2double * > > limits_table_y
Definition CLookUpTable.hpp:70
void ComputeInterpCoeffs()
Compute vector of all (inverse) interpolation coefficients "interp_mat_inv_x_y" of all triangles.
Definition CLookUpTable.cpp:351
su2vector< std::vector< std::array< unsigned long, 2 > > > edges
Edge information for each table level.
Definition CLookUpTable.hpp:94
const su2double * GetDataP(const std::string &name_var, unsigned long i_level=0) const
Get the pointer to the column data of the table (density, temperature, source terms,...
Definition CLookUpTable.hpp:128
std::string version_reader
Reader version (should be equal or above LUT version).
Definition CLookUpTable.hpp:49
int rank
MPI Rank.
Definition CLookUpTable.hpp:45
std::string file_name_lut
LUT file name.
Definition CLookUpTable.hpp:47
unsigned long idx_CV1
Table variable index of controlling variable 1.
Definition CLookUpTable.hpp:53
su2vector< su2vector< unsigned long > > hull
The hull contains the boundary of the lookup table.
Definition CLookUpTable.hpp:100
su2vector< su2vector< su2activematrix > > interp_mat_inv_x_y
Vector of all the weight factors for the interpolation.
Definition CLookUpTable.hpp:110
unsigned short table_dim
Table dimension.
Definition CLookUpTable.hpp:65
su2vector< unsigned long > n_hull_points
Number of outer boundary points per table level.
Definition CLookUpTable.hpp:59
unsigned long n_variables
Definition CLookUpTable.hpp:61
double memory_footprint_data
Memory footprint of the loaded table data.
Definition CLookUpTable.hpp:83
std::pair< su2double *, su2double * > limits_table_z
The lower and upper limits of the z, y and x variable for each table level.
Definition CLookUpTable.hpp:69
unsigned long idx_CV2
Table variable index of controlling variable 2.
Definition CLookUpTable.hpp:54
void LoadTableRaw(const std::string &file_name_lut)
Read the lookup table from file and store the data.
Definition CLookUpTable.cpp:112
su2vector< std::string > names_var
Holds the variable names stored in the table file. Order is in sync with data.
Definition CLookUpTable.hpp:75
bool LookUp_XY(const unsigned long idx_var, su2double *val_var, const su2double val_CV1, const su2double val_CV2, const unsigned long i_level=0)
Lookup value of variable stored under idx_var using controlling variable values(val_CV1,...
Definition CLookUpTable.cpp:589
su2vector< su2activematrix > table_data
Holds all data stored in the table. First index addresses the variable while second index addresses t...
Definition CLookUpTable.hpp:81
void PrintTableInfo()
Print information to screen.
Definition CLookUpTable.cpp:173
unsigned long FindNearestNeighborOnHull(su2double val_CV1, su2double val_CV2, unsigned long i_level=0)
Find the point on the hull (boundary of the table) that is closest to the point P(val_CV1,...
Definition CLookUpTable.cpp:675
std::string name_CV2
Name of controlling variable 2.
Definition CLookUpTable.hpp:51
unsigned long idx_null
Variable index corresponding to NULL variable.
Definition CLookUpTable.hpp:55
void IdentifyUniqueEdges()
Construct a list of all the edges and a list of the pair of elements left and right of the edge.
Definition CLookUpTable.cpp:246
passivedouble su2double
Definition code_config.hpp:181
#define CURRENT_FUNCTION
Definition mpi_structure.hpp:59