TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Traitement_particulier_NS_THI_new.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 <Traitement_particulier_NS_THI_new.h>
17#include <MD_Vector_base.h>
18#include <Domaine.h>
19
20Implemente_base(Traitement_particulier_NS_THI_new,"Traitement_particulier_NS_THI_new",Traitement_particulier_NS_base);
21
23{
24 return is;
25}
26
28{
29 return is;
30}
31
33{
34 Motcle accouverte = "{" , accfermee = "}" ;
35 Motcle valec="val_Ec";
36 Motcle facon="facon_init";
37 Motcle motbidon, motlu;
38 is >> motbidon ;
39 if (motbidon == accouverte)
40 {
41 Motcles les_mots(2);
42 {
43 les_mots[0] = "init_Ec";
44 les_mots[1] = "calc_spectre";
45 }
46 {
47 is >> motlu;
48 while(motlu != accfermee)
49 {
50 int rang=les_mots.search(motlu);
51 switch(rang)
52 {
53 case 0 :
54 {
55 is >> init; // init_Ec = 1
56 if (init!=0)
57 {
58 is >> motlu;
59 if (motlu==valec)
60 {
61 is >> Ec_init; // read the value of Ec_init
62 Cerr << "With initialization of kinetic energy Ec_init= " << Ec_init << finl;
63 is >> motlu;
64 if (motlu==facon)
65 {
66 is >> fac_init; // Which value is the initialization based on??
67 Cerr << "With initialization of kinetic energy on Ecspat (init_fac==0) or Ecspec (init_fac==1) : fac_init=" << fac_init << finl;
68 }
69 }
70 else
71 {
72 Cerr << "Error while reading Traitement_particulier_NS_THI_new_VDF" << finl;
73 Cerr << "The only possible keyword here is: val_Ec" << finl;
74 Cerr << "You read:" << motlu << finl;
75 exit();
76 }
77 }
78 break;
79 }
80 case 1 :
81 {
82 is >> oui_calc_spectre;
83 if (oui_calc_spectre!=0) Cerr << "Computing spectra." << finl;
84 break;
85 }
86
87 default :
88 {
89 Cerr << "Error while reading Traitement_particulier_NS_THI_new";
90 Cerr << "Possible keywords are: init_Ec, calc_spectre, { and }" << finl;
91 Cerr << "You read:" << motlu << finl;
92 exit();
93 break;
94 }
95 }
96 is >> motlu;
97 }
98 is >> motlu;
99 if (motlu != accfermee)
100 {
101 Cerr << "Error while reading Traitement_particulier_NS_THI_new";
102 Cerr << "We expected a }" << finl;
103 exit();
104 }
105 }
106 }
107 else
108 {
109 Cerr << "Error while reading Traitement_particulier_NS_THI_new";
110 Cerr << "We expected a {" << finl;
111 exit();
112 }
113 return is;
114}
115
116
125
132
133void Traitement_particulier_NS_THI_new::en_cours_de_resolution(int nb_op, DoubleTab& u, DoubleTab& u_av, double dt)
134{
135 // it is actually never called, cf. below (Caroline)
136 if (oui_transf == 1)
137 {
138 // calcul_spectre_operateur( nb_op, u, u_av,dt);
139
140 // Patrick
141
142 Cerr << " finally Traitement_particulier_NS_THI_new::en_cours_de_resolution is indeed called (?) " << finl;
143 exit();
144 }
145 return;
146}
147
149{
150 const char* methode_actuelle="Traitement_particulier_NS_THI_new::calcul_nb_som_dir";
151
152 // Used to compute the number of common vertices in parallel
153 double nb_som = static_cast<double>(domaine.md_vector_sommets()->nb_items_seq_tot());
154 // Sum over all processors
155
156 double nb=pow(nb_som*1.,1./3.);
157 nb_som_dir = (int)(nb);
158 if (nb_som_dir*nb_som_dir*nb_som_dir != nb_som)
159 {
161 if (nb_som_dir*nb_som_dir*nb_som_dir != nb_som)
162 msg_erreur_maillage(methode_actuelle);
163 }
165 return nb_som_dir;
166}
167
169{
170 if (je_suis_maitre())
171 {
172 Cerr << finl;
173 Cerr << "Problem in " << methode_actuelle << " :" << finl;
174 Cerr << "Your mesh does not seem to have the same number of nodes" << finl;
175 Cerr << "in all directions. Check your data file... " << finl << finl;
176 // Abort for parallel cases!
177 abort();
178 }
179}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
A character string (Nom) in uppercase.
Definition Motcle.h:26
An array of Motcle objects.
Definition Motcle.h:63
int search(const Motcle &t) const
Definition Motcle.cpp:319
friend class Entree
Definition Objet_U.h:71
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void abort()
Abort routine for TRUST on a fatal error.
Definition Process.cpp:573
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
Definition Process.cpp:82
Base class for output streams.
Definition Sortie.h:52
Traitement_particulier_THI_new This class performs specific post-processing treatments.
void en_cours_de_resolution(int, DoubleTab &, DoubleTab &, double) override
Traitement_particulier_NS_base Derives from Support_Champ_Masse_Volumique: use of rho.