Documentation 6b54b78464
Loading...
Searching...
No Matches
CMarkerProfileReaderFVM.hpp
Go to the documentation of this file.
1/*!
2 * \file CMarkerProfileReaderFVM.hpp
3 * \brief Header file for the class CMarkerProfileReaderFVM.
4 * The implementations are in the <i>CMarkerProfileReaderFVM.cpp</i> file.
5 * \author T. Economon
6 * \version 8.5.0 "Harrier"
7 *
8 * SU2 Project Website: https://su2code.github.io
9 *
10 * The SU2 Project is maintained by the SU2 Foundation
11 * (http://su2foundation.org)
12 *
13 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
14 *
15 * SU2 is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * SU2 is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29#pragma once
30
31#include <fstream>
32#include <string>
33#include <vector>
34#include <iomanip>
35
36#include "../../Common/include/parallelization/mpi_structure.hpp"
37#include "../../Common/include/CConfig.hpp"
38#include "../../Common/include/geometry/CGeometry.hpp"
39
40using namespace std;
41
42/*!
43 * \class CMarkerProfileReaderFVM
44 * \brief Class for the marker profile reader of the finite volume solver (FVM).
45 * \author: T. Economon
46 */
48
49protected:
50
51 int rank; /*!< \brief MPI Rank. */
52 int size; /*!< \brief MPI Size. */
53
54 CConfig *config; /*!< \brief Local pointer to the config parameter object. */
55
56 CGeometry *geometry; /*!< \brief Local pointer to the geometry object. */
57
58 unsigned short dimension; /*!< \brief Dimension of the problem (2 or 3). */
59 unsigned short markerType; /*!< \brief Type of marker where the profiles are being applied. */
60
61 unsigned short numberOfVars; /*!< \brief Number of variables added to the number of coordinates to write each line in the template profile file. */
62
63 unsigned long numberOfProfiles; /*!< \brief Auxiliary structure for holding the number of markers in a profile file. */
64
65 string filename; /*!< \brief File name of the marker profile file. */
66
67 vector<string> columnNames; /*!< \brief string containing all the names of the columns, one for each marker */
68 vector<string> columnValues; /*!< \brief initial values for the profile, in string format */
69
70 vector<string> profileTags; /*!< \brief Auxiliary structure for holding the string names of the markers in a profile file. */
71
72 vector<unsigned long> numberOfRowsInProfile; /*!< \brief Auxiliary structure for holding the number of rows for a particular marker in a profile file. */
73 vector<unsigned long> numberOfColumnsInProfile; /*!< \brief Auxiliary structure for holding the number of columns for a particular marker in a profile file. */
74 vector<string> totalColumnNames; /*!< \brief Names of the columns for the profile, one for each inlet marker. */
75 vector<string> totalColumnValues; /*!< \brief Initial values for the profile, constructed from MARKER_INLET. */
76
77 vector<vector<passivedouble> > profileData; /*!< \brief Auxiliary structure for holding the data values from a profile file. */
78 vector<vector<vector<su2double> > > profileCoords; /*!< \brief Data structure for holding the merged inlet boundary coordinates from all ranks. */
79
80private:
81
82 /*!
83 * \brief Read a native SU2 marker profile file in ASCII format.
84 */
85 void ReadMarkerProfile();
86
87 /*!
88 * \brief Merge the node coordinates of all profile-type boundaries from all processors.
89 */
90 void MergeProfileMarkers();
91
92 /*!
93 * \brief Write a template profile file if the requested file is not found.
94 */
95 void WriteMarkerProfileTemplate();
96
97public:
98
99 /*!
100 * \brief Constructor of the CMarkerProfileReaderFVM class.
101 * \param[in] val_geometry - Pointer to the current geometry
102 * \param[in] val_config - Pointer to the current config structure
103 * \param[in] val_filename - Name of the profile file to be read
104 * \param[in] val_kind_marker - Type of marker where profile will be applied
105 * \param[in] val_number_vars - Number of columns of profile data to be written to template file (excluding coordinates)
106 */
108 CConfig *val_config,
109 string val_filename,
110 unsigned short val_kind_marker,
111 unsigned short val_number_vars,
112 vector<string> val_columnNames,
113 vector<string> val_columnValues);
114
115 /*!
116 * \brief Destructor of the CMeshReaderFVM class.
117 */
119
120 /*!
121 * \brief Get the number of profiles found within the input file.
122 * \returns Number of profiles found within the input file.
123 */
124 inline unsigned long GetNumberOfProfiles() const {
125 return numberOfProfiles;
126 }
127
128 /*!
129 * \brief Get the string tag for the marker where the profile is applied.
130 * \param[in] val_iProfile - current profile index.
131 * \returns String tag for the marker where the profile is applied.
132 */
133 inline const string &GetTagForProfile(int val_iProfile) const {
134 return profileTags[val_iProfile];
135 }
136
137 /*!
138 * \brief Get the number of rows of data in a profile.
139 * \param[in] val_iProfile - current profile index.
140 * \returns Number of rows of data in a profile.
141 */
142 inline unsigned long GetNumberOfRowsInProfile(int val_iProfile) {
143 return numberOfRowsInProfile[val_iProfile];
144 }
145
146 /*!
147 * \brief Get the number of columns of data in a profile.
148 * \param[in] val_iProfile - current profile index.
149 * \returns Number of columns of data in a profile.
150 */
151 inline unsigned long GetNumberOfColumnsInProfile(int val_iProfile) {
152 return numberOfColumnsInProfile[val_iProfile];
153 }
154
155 /*!
156 * \brief Get the 1D vector of data for a profile from the input file.
157 * \param[in] val_iProfile - current profile index.
158 * \returns 1D vector of data for a profile from the input file.
159 */
160 inline const vector<passivedouble> &GetDataForProfile(int val_iProfile) const {
161 return profileData[val_iProfile];
162 }
163
164 /*!
165 * \brief Get the data for the specific column if interpolation being done.
166 * \param[in] val_iProfile - current profile index.
167 * \param[in] iCol - the column whose data is required
168 * \returns the specific column data.
169 */
170 inline vector<su2double> GetColumnForProfile(int val_iProfile, unsigned short iCol) const {
171 auto nRow = numberOfRowsInProfile[val_iProfile];
172 auto nCol = numberOfColumnsInProfile[val_iProfile];
173 vector<su2double> ColumnData(nRow);
174 for (unsigned long iRow = 0; iRow < nRow; iRow++)
175 ColumnData[iRow]=profileData[val_iProfile][iRow*nCol+iCol];
176 return ColumnData;
177 }
178};
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Class for the marker profile reader of the finite volume solver (FVM).
Definition CMarkerProfileReaderFVM.hpp:47
unsigned long GetNumberOfProfiles() const
Get the number of profiles found within the input file.
Definition CMarkerProfileReaderFVM.hpp:124
vector< unsigned long > numberOfColumnsInProfile
Auxiliary structure for holding the number of columns for a particular marker in a profile file.
Definition CMarkerProfileReaderFVM.hpp:73
vector< string > totalColumnValues
Initial values for the profile, constructed from MARKER_INLET.
Definition CMarkerProfileReaderFVM.hpp:75
vector< string > columnValues
initial values for the profile, in string format
Definition CMarkerProfileReaderFVM.hpp:68
vector< string > columnNames
string containing all the names of the columns, one for each marker
Definition CMarkerProfileReaderFVM.hpp:67
vector< vector< passivedouble > > profileData
Auxiliary structure for holding the data values from a profile file.
Definition CMarkerProfileReaderFVM.hpp:77
const vector< passivedouble > & GetDataForProfile(int val_iProfile) const
Get the 1D vector of data for a profile from the input file.
Definition CMarkerProfileReaderFVM.hpp:160
vector< string > totalColumnNames
Names of the columns for the profile, one for each inlet marker.
Definition CMarkerProfileReaderFVM.hpp:74
~CMarkerProfileReaderFVM(void)
Destructor of the CMeshReaderFVM class.
unsigned short markerType
Type of marker where the profiles are being applied.
Definition CMarkerProfileReaderFVM.hpp:59
vector< string > profileTags
Auxiliary structure for holding the string names of the markers in a profile file.
Definition CMarkerProfileReaderFVM.hpp:70
unsigned long GetNumberOfColumnsInProfile(int val_iProfile)
Get the number of columns of data in a profile.
Definition CMarkerProfileReaderFVM.hpp:151
int size
MPI Size.
Definition CMarkerProfileReaderFVM.hpp:52
unsigned long GetNumberOfRowsInProfile(int val_iProfile)
Get the number of rows of data in a profile.
Definition CMarkerProfileReaderFVM.hpp:142
string filename
File name of the marker profile file.
Definition CMarkerProfileReaderFVM.hpp:65
unsigned long numberOfProfiles
Auxiliary structure for holding the number of markers in a profile file.
Definition CMarkerProfileReaderFVM.hpp:63
vector< su2double > GetColumnForProfile(int val_iProfile, unsigned short iCol) const
Get the data for the specific column if interpolation being done.
Definition CMarkerProfileReaderFVM.hpp:170
CConfig * config
Local pointer to the config parameter object.
Definition CMarkerProfileReaderFVM.hpp:54
unsigned short numberOfVars
Number of variables added to the number of coordinates to write each line in the template profile fil...
Definition CMarkerProfileReaderFVM.hpp:61
vector< vector< vector< su2double > > > profileCoords
Data structure for holding the merged inlet boundary coordinates from all ranks.
Definition CMarkerProfileReaderFVM.hpp:78
const string & GetTagForProfile(int val_iProfile) const
Get the string tag for the marker where the profile is applied.
Definition CMarkerProfileReaderFVM.hpp:133
CGeometry * geometry
Local pointer to the geometry object.
Definition CMarkerProfileReaderFVM.hpp:56
unsigned short dimension
Dimension of the problem (2 or 3).
Definition CMarkerProfileReaderFVM.hpp:58
vector< unsigned long > numberOfRowsInProfile
Auxiliary structure for holding the number of rows for a particular marker in a profile file.
Definition CMarkerProfileReaderFVM.hpp:72
int rank
MPI Rank.
Definition CMarkerProfileReaderFVM.hpp:51