TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
champ_init_canal_sinal.h
1/****************************************************************************
2* Copyright (c) 2022, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef champ_init_canal_sinal_included
17#define champ_init_canal_sinal_included
18
19#include <TRUSTChamp_Divers_generique.h>
20
21class champ_init_canal_sinal : public TRUSTChamp_Divers_generique<Champ_Divers_Type::CANAL>
22{
23 Declare_instanciable(champ_init_canal_sinal);
24public :
25 DoubleVect& valeur_a(const DoubleVect& position, DoubleVect& valeurs) const override;
26 double valeur_a_elem_compo(const DoubleVect& position, int le_poly, int ncomp) const override;
27 DoubleTab& valeur_aux(const DoubleTab& positions, DoubleTab& valeurs) const override;
28 DoubleVect& valeur_aux_compo(const DoubleTab& positions, DoubleVect& valeurs, int ncomp) const override;
29
30protected :
31 double Ucent = -1., h = -1., ampli_bruit = -1., omega = -1., ampli_sin = -1.;
32 // Initialisation par defaut des minimums et maximums pour generaliser l'initialisation du canal pour n'importe quelle position dans l'espace.
33 int dir_wall = 1, dir_flow = 0;
34 double min_dir_flow = 0., min_dir_wall = 0.;
35
36 inline double fx(double x) const { return 0.; }
37
38 inline double fx(double x, double y) const
39 {
40 return Ucent / (h * h) * (y - min_dir_wall) * (2.0 * h - (y - min_dir_wall));
41 }
42
43 inline double fy(double x, double y) const
44 {
45 return ampli_bruit * (-0.5 + drand48()) + ampli_sin * sin(omega * (x - min_dir_flow));
46 }
47
48 inline double fx(double x, double y, double z) const
49 {
50 return Ucent / (h * h) * (y - min_dir_wall) * (2.0 * h - (y - min_dir_wall));
51 }
52
53 inline double fy(double x, double y, double z) const
54 {
55 return ampli_bruit * (-0.5 + drand48()) + ampli_sin * sin(omega * (x - min_dir_flow));
56 }
57
58 inline double fz(double x, double y, double z) const
59 {
60 return ampli_bruit * (-0.5 + drand48());
61 }
62};
63
64#endif /* champ_init_canal_sinal_included */
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
DoubleTab & valeur_aux(const DoubleTab &positions, DoubleTab &valeurs) const override
Provoque une erreur ! Doit etre surchargee par les classes derivees.
DoubleVect & valeur_a(const DoubleVect &position, DoubleVect &valeurs) const override
Calcule les "valeurs" du champ au point de coordonnees "pos".
double valeur_a_elem_compo(const DoubleVect &position, int le_poly, int ncomp) const override
provoque une erreur ! doit etre surchargee par les classes derivees
double fz(double x, double y, double z) const
double fx(double x) const
double fx(double x, double y, double z) const
DoubleVect & valeur_aux_compo(const DoubleTab &positions, DoubleVect &valeurs, int ncomp) const override
Idem que valeur_aux(const DoubleTab &, DoubleTab &), mais calcule uniquement la composante compo du c...
double fx(double x, double y) const
double fy(double x, double y) const
double fy(double x, double y, double z) const