Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYCheminDefaultSolver.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
16 #include "TYCheminDefaultSolver.h"
18 
20 {
22 }
23 
25 {
26  *this = other;
27 }
28 
30 {
31  if (this != &other)
32  {
33  TYChemin::operator=(other);
34  _attenuation = other._attenuation;
35  }
36 
37  return *this;
38 }
39 
41 {
42  if (this != &other)
43  {
44  if (TYChemin::operator!=(other))
45  {
46  return false;
47  }
48  if (_attenuation != other._attenuation)
49  {
50  return false;
51  }
52  }
53 
54  return true;
55 }
56 
58 {
59  return !operator==(other);
60 }
61 
63  const AtmosphericConditions& atmos)
64 {
65  unsigned int i = 0;
66 
67  OSpectre phase = OSpectre::getEmptyLinSpectre(); // Reference de phase
68 
69  switch (_typeChemin)
70  {
71  case TYTypeChemin::CHEMIN_DIRECT: // S*A*e^(i.k.Rd) avec A =attenuation atmosphere et S=directivite de
72  // la source
73  _attenuation = tabEtapes[0]._Absorption; // directivite de la source (S)
74  // _attenuation = _attenuation.mult(atmos.getAtt(_longueur)); // S*A (A = attenuation
75  // atmospherique)
77  atmos.compute_length_absorption(_longueur)); // S*A (A = attenuation atmospherique)
78 
79  // phase = atmos.getKAcoust().mult(_longueur); // = kRd
80  phase = atmos.get_k().mult(_longueur); // = kRd
81  _attenuation.setPhase(phase); // =e^(i.kRd) //*/
82 
83  break;
84 
85  case TYTypeChemin::CHEMIN_SOL: // S*A*Q*e^(i.k.Rr)/Rr //avec Q absorption du sol
86  _attenuation = tabEtapes[0]._Absorption; // directivite de la source (S)
88  atmos.compute_length_absorption(_longueur)); // S*A (A = attenuation atmospherique)
89 
90  _attenuation = _attenuation.mult(tabEtapes[1]._Absorption); // S*A*Q
91  _attenuation = _attenuation.mult(_distance / _longueur); // S*A*Q*Rd / Rr
92 
93  phase = atmos.get_k().mult(_longueur); // = kRr
94  phase = phase.sum(
95  tabEtapes[1]
96  ._Absorption.getPhase()); // kRr + epsilon (epsilon = phase du coeff de reflexion du sol
97 
98  _attenuation.setPhase(phase);
99 
100  break;
101 
102  case TYTypeChemin::CHEMIN_ECRAN: //= S*A*Q/D*e^(i.k.Rd + eps) avec Q=module du coefficient de
103  // reflexion du sol et
104  // D=attenuation diffraction
105  _attenuation = tabEtapes[0]._Absorption; // S = Directivite de la source
107  atmos.compute_length_absorption(_longueur)); // S*A (A = attenuation atmospherique)
108 
109  phase = atmos.get_k().mult(_longueur); // = kRr
110 
111  // On fait le produit des absorptions des etapes a partir de la seconde jusqu'a l'avant derniere
112  // la derniere portant l'effet de diffraction
113  for (i = 1; i < tabEtapes.size() - 1; i++)
114  {
115  _attenuation = _attenuation.mult(tabEtapes[i]._Absorption); // S.A.Q
116  phase = phase.sum(tabEtapes[i]._Absorption.getPhase()); // kRr + Somme des epsilon i
117  }
118 
119  _attenuation = _attenuation.div(tabEtapes[tabEtapes.size() - 1]._Attenuation); // S.A.Q/D
120 
121  _attenuation.setPhase(phase);
122  break;
123 
124  case TYTypeChemin::CHEMIN_REFLEX: // S*A*Q*e^(i.k.Rr + eps)/Rr avec Q coefficient de reflexion de la
125  // paroi, eps = 0
126  _attenuation = tabEtapes[0]._Absorption; // S = Directivite de la source
128  atmos.compute_length_absorption(_longueur)); // S*A (A = attenuation atmospherique)
129 
130  phase = atmos.get_k().mult(_longueur); // = kRr
131 
132  // On fait le produit des absorptions des etapes ) partir de la deuxieme
133  for (i = 1; i < tabEtapes.size(); i++)
134  {
135  _attenuation = _attenuation.mult(tabEtapes[i]._Absorption); // Produit des modules
136  phase = phase.sum(tabEtapes[i]._Absorption.getPhase()); // Somme des phases
137  }
138 
140  _distance /
141  _longueur); // <== MODIFIE ON DIVISE PAR Rd² au niveau du solveur (a cause des ecrans)
142 
143  _attenuation.setPhase(phase);
144 
145  break;
146 
147  default:
148  break;
149  }
150 
151  build_eq_path(tabEtapes);
152 }
Representation of one of the most optimal path between source and receptor: S—>R Specific derivation ...
std::deque< TYEtapeDefaultSolver > TYTabEtapeDefaultSolver
TYEtape collection.
Class for the definition of atmospheric conditions.
OSpectre compute_length_absorption(double length) const
const OSpectre & get_k() const
Get the wave number spectrum.
OSpectreAbstract & sum(const OSpectreAbstract &spectre) const
Arithmetic sum of two spectrums in one-third Octave.
Definition: spectre.cpp:224
OSpectreAbstract & div(const OSpectreAbstract &spectre) const
Division of two spectrums.
Definition: spectre.cpp:278
OSpectreAbstract & mult(const OSpectreAbstract &spectre) const
Multiplication of two spectrums.
Definition: spectre.cpp:248
void setPhase(const OSpectre &spectre)
Definition: spectre.cpp:1363
static OSpectre getEmptyLinSpectre(const double &valInit=1.0E-20)
Create a physical quantity spectrum.
Definition: spectre.cpp:1129
Representation of one of the most optimal path between source and receptor: S—>R. The class TYChemin ...
bool operator==(const TYCheminDefaultSolver &other) const
Operator ==.
TYCheminDefaultSolver & operator=(const TYCheminDefaultSolver &other)
Operator =.
bool operator!=(const TYCheminDefaultSolver &other) const
Operator !=.
OSpectreComplex _attenuation
Attenuation spectrum of the path.
void calcAttenuation(const TYTabEtapeDefaultSolver &tabEtapes, const AtmosphericConditions &atmos)
Compute the global attenuation on the path.
Representation of one of the most optimal path between source and receptor: S—>R. The class TYChemin ...
Definition: TYChemin.h:64
double _distance
Direct distance between source and receptor.
Definition: TYChemin.h:174
TYTypeChemin _typeChemin
Path type (has an influence on the algorithm)
Definition: TYChemin.h:168
TYChemin & operator=(const TYChemin &other)
Operator =.
Definition: TYChemin.cpp:37
void build_eq_path(const T &tabEtapes)
build an acoustic_path from the tab of etapes
Definition: TYChemin.h:156
double _longueur
Total path length.
Definition: TYChemin.h:171
This file provides class for solver configuration.