MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
variables.cpp
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#include "variables.h"
8
9#include "MEMORY/alloc.h"
10
11namespace maia {
12namespace fv {
13
16
17template <MInt nd>
18const std::array<MInt, 3> ConservativeVariables<nd>::RHO_VV;
19
20template <MInt nd>
22 : RHO_Z(nd + 2 + noRans),
23 RHO_C(nd + 2 + noRans),
24 m_noSpecies(noSpecies),
25 m_noRansEquations(noRans),
26 noVariables(nd + 2 + noRans + noSpecies) {
27 if(m_noRansEquations > 0) {
28 mAlloc(RHO_NN, m_noRansEquations, "maia::fv::ConservativeVariables::RHO_NN", AT_);
29 for(MInt i = 0; i < m_noRansEquations; ++i) {
30 RHO_NN[i] = RHO_N + i;
31 }
32 }
33 if(m_noSpecies > 0) {
34 mAlloc(RHO_Y, m_noSpecies, "maia::fv::ConservativeVariables::RHO_Y", AT_);
35 for(MInt i = 0; i < m_noSpecies; ++i) {
36 RHO_Y[i] = RHO_Z + i;
37 }
38 }
39}
40
41
42template <MInt nd>
44 mDeallocate(RHO_Y);
45}
46
47template struct ConservativeVariables<2>;
48template struct ConservativeVariables<3>;
49
52
53template <MInt nd>
54const std::array<MInt, 3> PrimitiveVariables<nd>::VV;
55
56template <MInt nd>
58 : Z(nd + 2 + noRans),
59 C(nd + 2 + noRans),
60 m_noSpecies(noSpecies),
61 m_noRansEquations(noRans),
62 noVariables(nd + 2 + noRans + noSpecies) {
63 if(m_noRansEquations > 0) {
64 mAlloc(NN, m_noRansEquations, "maia::fv::PrimitiveVariables::NN", AT_);
65 for(MInt i = 0; i < m_noRansEquations; ++i) {
66 NN[i] = N + i;
67 }
68 }
69 if(m_noSpecies > 0) {
70 mAlloc(Y, m_noSpecies, "maia::fv::PrimitiveVariables::Y", AT_);
71 for(MInt i = 0; i < m_noSpecies; ++i) {
72 Y[i] = Z + i;
73 }
74 }
75}
76
77template <MInt nd>
79 mDeallocate(Y);
80}
81
82template struct PrimitiveVariables<2>;
83template struct PrimitiveVariables<3>;
84
85} // namespace fv
86} // namespace maia
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
Definition: alloc.h:173
MBool mDeallocate(T *&a)
deallocates the memory previously allocated for element 'a'
Definition: alloc.h:544
int32_t MInt
Definition: maiatypes.h:62
Namespace for auxiliary functions/classes.
Static indices for accessing conservative variables in nd spatial dimensions.
Definition: variables.h:199
static constexpr std::array< MInt, 3 > RHO_VV
ConservativeVariables:
Definition: variables.h:203
static constexpr MInt RHO_N
Definition: variables.h:208
ConservativeVariables(const MInt noSpecies, const MInt noRans)
Definition: variables.cpp:21
Static indices for accessing primitive variables in nd spatial dimensions.
Definition: variables.h:224
static constexpr MInt N
Definition: variables.h:235
PrimitiveVariables(const MInt noSpecies, const MInt noRans)
Definition: variables.cpp:57