TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Fluide_MUSIG.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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#include <Fluide_MUSIG.h>
17
18Implemente_instanciable( Fluide_MUSIG, "Fluide_MUSIG", Fluide_base ) ;
19
20Sortie& Fluide_MUSIG::printOn(Sortie& os) const { return Objet_U::printOn(os); }
21
23{
24 Nom mot;
25 int verifFluide = 0;
26 is >> mot;
27 diametres_.resize(0);
28 if (mot != "{")
29 {
30 Cerr << "Fluide_MUSIG : { expected instead of " << mot << finl;
32 }
33 for (is >> mot; mot != "}"; is >> mot)
34 {
35 if(Motcle(mot) == "FLUIDE")
36 {
37 OWN_PTR(Fluide_base) fluide;
38 fluide.typer_lire_simple(is, "Typing the fluid medium ...");
39
40 verifFluide++;
41 if (fluide->has_porosites())
42 {
43 Cerr << que_suis_je() + " : porosity should be defined only once in the milieu_MUSIG block, not in " + fluide->que_suis_je() << finl;
45 }
46 if (fluide->a_gravite())
47 {
48 Cerr << que_suis_je() + " : gravity should be defined only once in the milieu_MUSIG block, not in " + fluide->que_suis_je() << finl;
50 }
51 if (fluide->has_hydr_diam())
52 {
53 Cerr << que_suis_je() + " : diametre_hyd_champ should be defined only once in the milieu_MUSIG block, not in " + fluide->que_suis_je() << finl;
55 }
56 if (!sub_type(Fluide_base,fluide.valeur()))
57 {
58 Cerr << que_suis_je() + " : only real fluids should be read and not a fluid of type " + fluide->que_suis_je() << finl;
60 }
61 fluide_= fluide;
62
63 }
64 else if(Motcle(mot) == "NBPHASES")
65 {
66 is >> nbSubPhases_;
67 }
68 else if(Motcle(mot) == "DIAMETRES" || Motcle(mot) == "DIAMETERS") // Definition of the parameter diameters
69 {
70 if (nbSubPhases_ < 0) // Check that the number of underlying phases is defined
71 {
72 Cerr << "Fluide_MUSIG : you need to define nbPhases before " << mot << finl;
74 }
75
76 double dMin=-1, dMax=-1;
77 int repartionType=0; ///< save the repartition law of the diameters (0=linear,1=logarithmic)
78 is >> mot;
79 if (mot != "{")
80 {
81 Cerr << "Fluide_MUSIG : { expected after the key word diametre instead of " << mot << finl;
83 }
84 for (is >> mot; mot != "}"; is >> mot)
85 {
86 if (Motcle(mot) == "DMIN")
87 {
88 is >> dMin;
89 }
90 if (Motcle(mot) == "DMAX")
91 {
92 is >> dMax;
93 }
94 if (Motcle(mot) == "LIN")
95 {
96 repartionType=0;
97 }
98 if (Motcle(mot) == "LOG")
99 {
100 repartionType=1;
101 }
102 }
103 if(dMin<0 || dMax <0 || dMin > dMax)
104 {
105 Cerr << "You need to define dMin and dMax with 0 < dMin < dMax " << mot << finl;
107 }
108 //Storing of diameters
109 diametres_.resize(nbSubPhases_+1);
110 for( int i =0; i<nbSubPhases_+1; i++)
111 {
112 if(repartionType == 0) // linear
113 {
114 diametres_[i] = dMin + i*(dMax-dMin)/(nbSubPhases_);
115 }
116 else if(repartionType == 1) //logarithmic
117 {
118 double lnDiameter = log(dMin)+i*(log(dMax)-log(dMin))/(nbSubPhases_);
119 diametres_[i] = exp(lnDiameter);
120 }
121 else
122 {
123 Cout << "Fluide_MUSIG - Diametre : You need to choose between LIN - LOG for diameters repartitions" << finl;
125 }
126 }
127 }
128 }
129
130
131 if(verifFluide == 0)
132 {
133 Cerr << que_suis_je() + ": You need to define a fluid inside FLuide_MUSIG with parameter fluide" << finl;
135 }
136 else if (verifFluide > 1 )
137 {
138 Cerr << que_suis_je() + ": You need to define only one fluid inside Fluide_MUSIG" << finl;
140 }
141 else if (nbSubPhases_ < 1)
142 {
143 Cerr << que_suis_je() + ": You need to precise the number of sub-phases with parameter nbPhases" << finl;
145 }
146 return is;
147}
148
149int Fluide_MUSIG::initialiser(const double temps) // This overload might not be necessary
150{
151 return 1;
152}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe Fluide_MUSIG.
DoubleTab diametres_
int initialiser(const double temps) override
Initialise les parametres du fluide.
const OWN_PTR(Fluide_base) &get_Fluide() const
classe Fluide_base Cette classe represente un d'un fluide incompressible ainsi que
Definition Fluide_base.h:38
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52