MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
variables.h
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#ifndef MAIA_VARIABLES_H_
8#define MAIA_VARIABLES_H_
13#include <array>
14#include <limits>
15#include "INCLUDE/maiatypes.h"
17
30template <MInt nDim>
32 public:
34 explicit MConservativeVariables(MInt noSpecies, MInt noRANSEq = 0) {
35 m_noSpecies = noSpecies;
36 m_noRansEquations = noRANSEq;
37 for(MInt i = 0; i < nDim; i++) {
38 RHO_VV[i] = RHO_U + i;
39 }
40 RHO_Y = new MInt[m_noSpecies];
41 for(MInt i = 0; i < m_noSpecies; i++) {
42 RHO_Y[i] = RHO_Z + i;
43 }
44 RANS_FIRST = nDim + 2;
45 if(m_noSpecies != 0) {
46 RANS_FIRST = nDim + 2 + m_noSpecies;
47 }
48 if(m_noRansEquations > 0) {
50 for(MInt i = 0; i < m_noRansEquations; ++i) {
51 RANS_VAR[i] = RANS_FIRST + i;
52 }
53 } else {
54 RANS_VAR = nullptr;
55 }
57 }
58
60 delete[] RHO_Y;
61 if(RANS_VAR != nullptr) {
62 delete[] RANS_VAR;
63 }
64 }
65
67 static constexpr MInt RHO_U = 0;
69 static constexpr MInt RHO_V = 1;
71 static constexpr MInt RHO_W = 2;
73 std::array<MInt, nDim> RHO_VV;
75 static constexpr MInt RHO_E = nDim;
77 static constexpr MInt RHO = nDim + 1;
79 static constexpr MInt RHO_Z = nDim + 2;
81 static constexpr MInt RHO_C = nDim + 2;
83 MInt* RHO_Y = nullptr;
87 MInt* RANS_VAR = nullptr;
88
89
95 std::array<MFloat, nDim> ransInfinity{};
96 std::array<MFloat, nDim> rhoVVInfinity{};
97};
98
109template <MInt nDim>
111 public:
113 explicit MPrimitiveVariables(MInt noSpecies, MInt noRANSEq = 0) {
114 m_noSpecies = noSpecies;
115 m_noRansEquations = noRANSEq;
116
117 Y = new MInt[m_noSpecies];
118 for(MInt i = 0; i < m_noSpecies; i++) {
119 Y[i] = Z + i;
120 }
121 // G = nDim+1;
122
123 RANS_FIRST = nDim + 2;
124 if(m_noSpecies != 0) {
125 RANS_FIRST = nDim + 2 + m_noSpecies;
126 }
127 if(m_noRansEquations > 0) {
129 for(MInt i = 0; i < m_noRansEquations; ++i) {
130 RANS_VAR[i] = RANS_FIRST + i;
131 }
132 } else {
133 RANS_VAR = nullptr;
134 }
135
137 }
139 delete[] Y;
140 if(RANS_VAR != nullptr) {
141 delete[] RANS_VAR;
142 }
143 }
144
146 static constexpr MInt U = 0;
148 static constexpr MInt V = 1;
150 static constexpr MInt W = 2;
152#if !defined(MAIA_PGI_COMPILER) && defined(NDEBUG) && !defined(MAIA_SANITIZE_ADDRESS) && !defined(MAIA_INTEL_COMPILER)
153 static constexpr std::array<MInt, 3> VV = {0, 1, 2};
154#else
155 std::array<MInt, 3> VV = {0, 1, 2};
156#endif
158 static constexpr MInt P = nDim + 1;
160 static constexpr MInt RHO = nDim;
162 static constexpr MInt T = nDim + 1;
164 static constexpr MInt Z = nDim + 2;
166 static constexpr MInt C = nDim + 2;
173
179 std::array<MFloat, nDim> VVInfinity;
180 std::array<MFloat, nDim> ransInfinity;
182};
183
186
187namespace maia {
188
189namespace fv {
190
191namespace variables {
193static const MInt Segfault = std::numeric_limits<MInt>::min();
194} // namespace variables
195
198template <MInt nd>
200 static constexpr MInt RHO_U = 0;
201 static constexpr MInt RHO_V = 1;
202 static constexpr MInt RHO_W = nd == 3 ? 2 : variables::Segfault;
203 static constexpr std::array<MInt, 3> RHO_VV = {0, 1, 2};
204 static constexpr MInt RHO_E = nd;
205 static constexpr MInt RHO = nd + 1;
206 const MInt RHO_Z;
207 const MInt RHO_C;
208 static constexpr MInt RHO_N = nd + 2;
209
213
214 MInt* RHO_NN = nullptr;
215 MInt* RHO_Y = nullptr;
216
217 explicit ConservativeVariables(const MInt noSpecies, const MInt noRans);
219};
220
223template <MInt nd>
225 static constexpr MInt U = 0;
226 static constexpr MInt V = 1;
227 static constexpr MInt W = nd == 3 ? 2 : variables::Segfault;
228 static constexpr std::array<MInt, 3> VV = {0, 1, 2};
229 static constexpr MInt RHO = nd;
230 static constexpr MInt P = nd + 1;
231 static constexpr MInt T = nd + 1;
232
233 const MInt Z;
234 const MInt C;
235 static constexpr MInt N = nd + 2;
236
240
241 MInt* NN = nullptr;
242 MInt* Y = nullptr;
243
244 explicit PrimitiveVariables(const MInt noSpecies, const MInt noRans);
246};
247
248} // namespace fv
249} // namespace maia
250#endif
Storage of the Position of the Conservative Variables (RHO, RHO_VV, RHO_E) in the value vectors of th...
Definition: variables.h:31
MConservativeVariables(MInt noSpecies, MInt noRANSEq=0)
Sets the position for the conservative variables.
Definition: variables.h:34
static constexpr MInt RHO_C
Position of RHO_C.
Definition: variables.h:81
MInt noVariables
The Nr. of Conservative Variables (nDim + 2)
Definition: variables.h:91
static constexpr MInt RHO_W
Position of RHO_W.
Definition: variables.h:71
static constexpr MInt RHO_U
Position of RHO_U.
Definition: variables.h:67
std::array< MInt, nDim > RHO_VV
Pointer for the velocities so you can use them in a loop.
Definition: variables.h:73
static constexpr MInt RHO_Z
Position of RHO_Z.
Definition: variables.h:79
static constexpr MInt RHO
Position of RHO.
Definition: variables.h:77
MInt * RANS_VAR
Position of RANS Variables.
Definition: variables.h:87
MInt RANS_FIRST
first Position of RANS Variables
Definition: variables.h:85
MInt * RHO_Y
Position of RHO_Yi.
Definition: variables.h:83
std::array< MFloat, nDim > ransInfinity
Definition: variables.h:95
static constexpr MInt RHO_E
Position of RHO_E.
Definition: variables.h:75
std::array< MFloat, nDim > rhoVVInfinity
Definition: variables.h:96
static constexpr MInt RHO_V
Position of RHO_V.
Definition: variables.h:69
Storage of the Position of the Primitive Variables (u, v, w, T, p) in the value vectors of the solver...
Definition: variables.h:110
MInt RANS_FIRST
first Position of RANS Variables
Definition: variables.h:170
std::array< MFloat, nDim > ransInfinity
Definition: variables.h:180
std::array< MFloat, nDim > VVInfinity
Definition: variables.h:179
static constexpr MInt T
Position of T.
Definition: variables.h:162
MInt * Y
Position of Yi.
Definition: variables.h:168
MPrimitiveVariables(MInt noSpecies, MInt noRANSEq=0)
Sets the position for the primitive variables.
Definition: variables.h:113
static constexpr MInt RHO
Position of RHO (equal to P in this case)
Definition: variables.h:160
static constexpr MInt U
Position of U.
Definition: variables.h:146
static constexpr MInt P
Position of P.
Definition: variables.h:158
static constexpr MInt C
Position of C.
Definition: variables.h:166
static constexpr std::array< MInt, 3 > VV
Pointer for the velocities so you can use them in a loop.
Definition: variables.h:153
static constexpr MInt Z
Position of Z.
Definition: variables.h:164
MInt noVariables
The Nr. of primitive variables (nDim + 2)
Definition: variables.h:175
static constexpr MInt V
Position of V.
Definition: variables.h:148
MInt * RANS_VAR
Position of RANS Variables.
Definition: variables.h:172
static constexpr MInt W
Position of W.
Definition: variables.h:150
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52
Namespace for auxiliary functions/classes.
Static indices for accessing conservative variables in nd spatial dimensions.
Definition: variables.h:199
static constexpr MInt RHO_E
Definition: variables.h:204
static constexpr std::array< MInt, 3 > RHO_VV
ConservativeVariables:
Definition: variables.h:203
static constexpr MInt RHO_V
Definition: variables.h:201
static constexpr MInt RHO_W
Definition: variables.h:202
static constexpr MInt RHO_N
Definition: variables.h:208
static constexpr MInt RHO
Definition: variables.h:205
static constexpr MInt RHO_U
Definition: variables.h:200
Static indices for accessing primitive variables in nd spatial dimensions.
Definition: variables.h:224
static constexpr MInt N
Definition: variables.h:235
static constexpr MInt P
Definition: variables.h:230
static constexpr MInt V
Definition: variables.h:226
static constexpr MInt RHO
Definition: variables.h:229
static constexpr MInt U
Definition: variables.h:225
static constexpr std::array< MInt, 3 > VV
PrimitiveVariables:
Definition: variables.h:228
static constexpr MInt T
Definition: variables.h:231
static constexpr MInt W
Definition: variables.h:227