Code_TYMPAN  4.4.0
Industrial site acoustic simulation
atmospheric_conditions.cpp
Go to the documentation of this file.
1 #include <math.h>
2 
4 
5 #ifndef M_PI
6  #define M_PI 3.1415926535897932384626433832795
7 #endif
8 
9 const double AtmosphericConditions::Z_ref = 400.0;
10 const double AtmosphericConditions::reference_pressure = 101325.0;
12 const double AtmosphericConditions::absolute_zero = 273.15;
13 
14 AtmosphericConditions::AtmosphericConditions(double static_pressure_, double temperature_, double hygrometry_)
15  : static_pressure(static_pressure_), temperature(temperature_), hygrometry(hygrometry_)
16 {
17  compute_k();
20 }
21 
23 {
24  double f2 = NAN; // Carre de la frequence de travail
25  double tA_classic = NAN, tA_N = NAN, tA_O = NAN; // Termes d'absoption classique, Azote Oxygene
26 
27  const double tK = temperature + absolute_zero; // temperature absolue exprimee en Kelvin
28  const double pr_rel = static_pressure / reference_pressure; // Pression relative
29  const double t_rel = tK / reference_temperature; // Temperature relative
30 
31  const double h_molaire = compute_hm();
32 
33  // Frequences de relaxation de l'oxygene (frO) et de l'azote (frN)
34  const double frO =
35  pr_rel * (24.0 + (4.04 * 10000.0 * h_molaire * ((0.02 + h_molaire) / (0.391 + h_molaire))));
36  const double frN = pr_rel * pow(t_rel, -0.5) *
37  (9.0 + 280.0 * h_molaire * exp((-4.170 * (pow(t_rel, (-1.0 / 3.0)) - 1))));
38 
40 
41  for (unsigned int i = 0; i < absorption_spectrum.getNbValues(); i++)
42  {
43  f2 = tabFreq[i] * tabFreq[i];
44 
45  tA_classic = 1.84e-11 * (1.0 / pr_rel) * sqrt(t_rel);
46  tA_O = 0.01275 * exp(-2239.1 / tK) * (1.0 / (frO + (f2 / frO)));
47  tA_N = 0.1068 * exp(-3352.0 / tK) * (1.0 / (frN + (f2 / frN)));
48 
50  (8.686 * f2 * (tA_classic + (pow(t_rel, -2.5) * (tA_O + tA_N))));
51  }
52 }
53 
55 {
56  absorption_spectrum_oct.setType(SPECTRE_TYPE_ABSO); // Absorption spectrum
57  unsigned int indiceDepart = 2;
58  unsigned int indice = 0;
59  for (unsigned int i = indiceDepart; i < TY_SPECTRE_DEFAULT_NB_ELMT - 2; i += 3, indice++)
60  {
62  round(absorption_spectrum.getTabValReel()[i + 1] * 10000) /
63  10; // Express absorption coefficient in dB per km round to one decimal place
64  }
65 }
66 
68 {
69  const double gamma = 1.41;
70  const double R = 8.31441;
71  const double M = 0.029;
72  const double tK = temperature + absolute_zero;
73 
74  return sqrt((gamma * R * tK) / M);
75 }
76 
78 {
79  const double R = 8.31441; // Constante des gazs parfaits
80  const double tK = temperature + absolute_zero;
81  const double M = 0.029; // Masse molaire de l'air
82 
83  return (M * (static_pressure / (R * tK))) * compute_c();
84 }
85 
87 {
88  double soundSpeed = compute_c();
90 
91  for (unsigned int i = 0; i < tabFreq.size(); i++)
92  {
93  wave_number.getTabValReel()[i] = (2 * M_PI * tabFreq[i]) / soundSpeed;
94  }
95 }
96 
98 {
99  double T01 = absolute_zero + 0.01; // Temperature isotherme au point triple
100  double tK = temperature + absolute_zero; // Temperature en Kelvin
101  double pr_rel = static_pressure / reference_pressure; // Pression relative
102 
103  double C = -6.8346 * pow((T01 / tK), 1.261) + 4.6151;
104 
105  double prSat_prRef = pow(10, C);
106 
107  return hygrometry * prSat_prRef * pr_rel;
108 }
109 
111 {
112  return absorption_spectrum.mult(-(length / 2.0)).toGPhy();
113 }
114 
116 {
117  return absorption_spectrum_oct * (length / 1000.0);
118 }
const std::vector< double > tabFreq
#define M_PI
void compute_k()
compute wave number
double hygrometry
Hygrometry.
OSpectre compute_length_absorption(double length) const
static const double Z_ref
reference impedance
double compute_z()
compute impedance
OSpectre absorption_spectrum
Absorption spectrum.
static const double absolute_zero
273.15 K
OSpectreOctave compute_length_absorption_oct(double length) const
AtmosphericConditions(double static_pressure_, double temperature_, double hygrometry_)
Constructor.
double static_pressure
Static pressure [Pa].
void compute_absorption_spectrum()
Compute absorption spectrum in dB/m.
OSpectreOctave absorption_spectrum_oct
static const double reference_temperature
Reference temperature [K].
OSpectre wave_number
Wave number spectrum.
static const double reference_pressure
Reference pressure [Pa].
double compute_hm() const
compute molar hygrometry coefficient
void compute_absorption_spectrum_oct()
Compute absorption spectrum in dB/m for octave band computation.
double temperature
Temperature [°C].
double compute_c() const
compute sound speed
OSpectreAbstract & toGPhy() const
Converts to physical quantity.
Definition: spectre.cpp:634
unsigned int getNbValues() const
Number of values in the spectrum.
Definition: spectre.cpp:182
void setType(TYSpectreType type)
Set the spectrum type.
Definition: spectre.h:152
OSpectreAbstract & mult(const OSpectreAbstract &spectre) const
Multiplication of two spectrums.
Definition: spectre.cpp:243
double * getTabValReel() override
Get an array of the real values of the spectrum.
Definition: spectre.h:613
double * getTabValReel() override
Definition: spectre.h:356
static OTabFreq getTabFreqExact()
Definition: spectre.cpp:979
std::vector< double > OTabFreq
Frequencies collection.
Definition: spectre.h:59
@ SPECTRE_TYPE_ABSO
Definition: spectre.h:29