ECOGEN 4.0
Evolutive, Compressible, Open, Genuine, Easy, N-phase
Loading...
Searching...
No Matches
Tools.h
Go to the documentation of this file.
1//
2// ,---. ,--, .---. ,--, ,---. .-. .-.
3// | .-' .' .') / .-. ) .' .' | .-' | \| |
4// | `-. | |(_) | | |(_) | | __ | `-. | | |
5// | .-' \ \ | | | | \ \ ( _) | .-' | |\ |
6// | `--. \ `-. \ `-' / \ `-) ) | `--. | | |)|
7// /( __.' \____\ )---' )\____/ /( __.' /( (_)
8// (__) (_) (__) (__) (__)
9// Official webSite: https://code-mphi.github.io/ECOGEN/
10//
11// This file is part of ECOGEN.
12//
13// ECOGEN is the legal property of its developers, whose names
14// are listed in the copyright file included with this source
15// distribution.
16//
17// ECOGEN is free software: you can redistribute it and/or modify
18// it under the terms of the GNU General Public License as published
19// by the Free Software Foundation, either version 3 of the License,
20// or (at your option) any later version.
21//
22// ECOGEN is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with ECOGEN (file LICENSE).
29// If not, see <http://www.gnu.org/licenses/>.
30
31#ifndef TOOLS_H
32#define TOOLS_H
33
34#include "Eos/Eos.h"
35
36//#define DEBUG
37
40
42enum Axis { X, Y, Z };
43
45enum TypeOutput { GNU, XML };
46
48enum TypeM { REC, UNS, AMR };
49
52
55
58
60enum VarBoundary { p, rho, velU, velV, velW, SIZE = (velW+1) };
61
64
66enum TypeRelax { P = 1, PT = 2, PTMU = 3 };
67
69enum TypeGrad { FD, GG };
70
72enum PhaseType { LIQ = 0, VAP = 1 };
73
75enum LimiterType { NONE = 0, MINMOD = 1, SUPERBEE = 2 };
76
80
82template<class Type>
83using TypeMeshContainer=std::vector<Type>;
84
86template <typename T> int sign(T val) {
87 return (T(0) < val) - (val < T(0));
88}
89
92class Tools
93{
94 public:
99 Tools(const int& numbPhases, const int& numbSolids, const int& numbTransports);
100 ~Tools();
101
104 static void uppercase(std::string& string);
107 static void lowercase(std::string& string);
108
112 static void swap(double &a, double &b);
113
116 double returnNonZeroValue(double a);
117
118 double* ak;
119 double* Yk;
120 double* rhok;
121 double* pk;
122 double* ek;
123 double* Ek;
124 double* akS;
125 double* rhokS;
126 double* rhokStar;
127 double* pkStar;
128 double* ekStar;
129 double* EkStar;
130 double* vkStar;
131 double* YkStar;
132 double* Deltapk;
133 double* zk;
136 double* Hk0;
137 double* Yk0;
138 double* compactionPk;
139 double* dlambda;
141 bool* alphaNull;
143
144 static double uselessDouble;
146};
147
148extern Tools *TB;
149extern int numberPhases;
150extern int numberSolids;
151extern int numberTransports;
152
153
154#endif // TOOLS_H
Tools * TB
Definition Tools.cpp:33
TypeOutput
Enumeration for the type of output (GNU, XML)
Definition Tools.h:45
@ XML
Definition Tools.h:45
@ GNU
Definition Tools.h:45
TypeM
Enumeration for the type of mesh (REC: rectilinear, UNS: unstructured, AMR: adaptative mesh refinemen...
Definition Tools.h:48
@ AMR
Definition Tools.h:48
@ REC
Definition Tools.h:48
@ UNS
Definition Tools.h:48
TypeData
Enumeration for the type of data (FLOAT, DOUBLE, INT, CHAR)
Definition Tools.h:51
@ DOUBLE
Definition Tools.h:51
@ CHAR
Definition Tools.h:51
@ FLOAT
Definition Tools.h:51
@ INT
Definition Tools.h:51
Prim
Enumeration for the primitive-variable type (usefull for second order, slopes, etc....
Definition Tools.h:39
@ vecPhases
Definition Tools.h:39
@ restart
Definition Tools.h:39
@ vecSlopes
Definition Tools.h:39
@ vecPhasesO2
Definition Tools.h:39
TypeBC
Enumeration for the type of boundary.
Definition Tools.h:57
@ NULLFLUX
Definition Tools.h:57
@ NONREFLECTING
Definition Tools.h:57
@ INLETINJTEMP
Definition Tools.h:57
@ INLETINJSTAGSTATE
Definition Tools.h:57
@ OUTLETMASSFLOW
Definition Tools.h:57
@ INLETTANK
Definition Tools.h:57
@ OUTLETPRESSURE
Definition Tools.h:57
@ SYMMETRY
Definition Tools.h:57
@ PISTON
Definition Tools.h:57
@ WALL
Definition Tools.h:57
TypeGrad
Enumeration for the gradient method (Finite-Difference (FD), Green-Gauss (GG))
Definition Tools.h:69
@ GG
Definition Tools.h:69
@ FD
Definition Tools.h:69
int numberSolids
Definition Cell.cpp:34
TypeGO
Enumeration for the type of geometric object (VERTEX, LINE, PLAN)
Definition Tools.h:54
@ VERTEX
Definition Tools.h:54
@ PLAN
Definition Tools.h:54
@ LINE
Definition Tools.h:54
LimiterType
Enumeration for the type of second order limiter (NS only)
Definition Tools.h:75
@ SUPERBEE
Definition Tools.h:75
@ MINMOD
Definition Tools.h:75
@ NONE
Definition Tools.h:75
int sign(T val)
Template for type-safe sign function.
Definition Tools.h:86
std::vector< Type > TypeMeshContainer
Template for the type of the mesh container (std::list for now, but may change to something else if w...
Definition Tools.h:83
TypeRelax
Enumeration for the type of relaxation (P, PT, PTMu)
Definition Tools.h:66
@ PTMU
Definition Tools.h:66
@ P
Definition Tools.h:66
@ PT
Definition Tools.h:66
VarBoundary
Enumeration for the variable to extract on a boundary.
Definition Tools.h:60
@ velU
Definition Tools.h:60
@ p
Definition Tools.h:60
@ velW
Definition Tools.h:60
@ SIZE
Definition Tools.h:60
@ rho
Definition Tools.h:60
@ velV
Definition Tools.h:60
Variable
Enumeration for the flow variables.
Definition Tools.h:78
int numberTransports
Definition Cell.cpp:35
Axis
Enumeration for the axes (X, Y and Z for the axes in the x-, y- and z-direction)
Definition Tools.h:42
@ Y
Definition Tools.h:42
@ X
Definition Tools.h:42
@ Z
Definition Tools.h:42
TypeBCHeat
Enumeration for the heat type of wall boundary (ADIABATIC, IMPOSEDTEMP, IMPOSEDFLUX)
Definition Tools.h:63
@ IMPOSEDTEMP
Definition Tools.h:63
@ IMPOSEDFLUX
Definition Tools.h:63
@ ADIABATIC
Definition Tools.h:63
int numberPhases
Definition Cell.cpp:33
PhaseType
Enumeration for the phase index of a liquid/vapor couple.
Definition Tools.h:72
@ VAP
Definition Tools.h:72
@ LIQ
Definition Tools.h:72
General class for Equation of State (EOS).
Definition Eos.h:54
Class for a matrix 3x3 system object.
Definition Tensor.h:46
Class for tools.
Definition Tools.h:93
static void swap(double &a, double &b)
Swap two numbers.
Definition Tools.cpp:125
Tensor * dplast
Plastic shear term, one for each phase.
Definition Tools.h:140
~Tools()
Definition Tools.cpp:80
static void uppercase(std::string &string)
Modify the string of characters to uppercase it.
Definition Tools.cpp:111
double * Yk0
Definition Tools.h:137
double * ekStar
Definition Tools.h:128
double * rhokS
Definition Tools.h:125
double * EkStar
Definition Tools.h:129
double * akS
Definition Tools.h:124
bool * alphaNull
Parameter to know if we consider the volume fraction as null or not.
Definition Tools.h:141
double * vkStar
Definition Tools.h:130
double * rho_cIksquare
Density times interface sound speed square, one for each phase.
Definition Tools.h:134
static double uselessDouble
Definition Tools.h:144
double * YkStar
Definition Tools.h:131
double * Hk0
Definition Tools.h:136
double * dlambda
Plastic compaction term, one for each phase.
Definition Tools.h:139
double * compactionPk
Compaction pressure, one for each phase.
Definition Tools.h:138
double * ek
Definition Tools.h:122
double * pkStar
Definition Tools.h:127
double * Ek
Definition Tools.h:123
double * rhok
Definition Tools.h:120
double * pk
Definition Tools.h:121
double returnNonZeroValue(double a)
Return a non-zero value of a float.
Definition Tools.cpp:134
Eos ** eos
Definition Tools.h:135
double * Yk
Definition Tools.h:119
double physicalTime
Current physical time.
Definition Tools.h:145
double * Deltapk
Pressure differences, one for each phase.
Definition Tools.h:132
static void lowercase(std::string &string)
Modify the string of characters to lowercase it.
Definition Tools.cpp:118
double * zk
Acoustic impedance of each phase.
Definition Tools.h:133
double * rhokStar
Definition Tools.h:126
double * ak
Definition Tools.h:118
bool * relaxSolidPlast
Parameter to know if we need the solid plastic relaxation.
Definition Tools.h:142