TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Operateur_IJK_faces_conv.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Operateur_IJK_faces_conv.h>
17#include <Param.h>
18
19Implemente_instanciable_sans_constructeur( Operateur_IJK_faces_conv, "Operateur_IJK_faces_conv", OWN_PTR(Operateur_IJK_faces_conv_base_double) ) ;
20
21Operateur_IJK_faces_conv::Operateur_IJK_faces_conv()
22{
23 convection_op_words_ = Motcles(5);
24 {
25 convection_op_words_[0] = "amont";
26 convection_op_words_[1] = "centre";
27 convection_op_words_[2] = "centre4";
28 convection_op_words_[3] = "quick";
29 convection_op_words_[4] = "quicksharp";
30 }
31 convection_op_ = "";
32 /* non_conservative_simple : rho div(u u)
33 * non_conservative_rhou : div(rho u u) - u div(rho u)
34 * conservative : div(rho u u)
35 */
36 convection_op_options_ = Motcles(3);
37 {
38 convection_op_options_[0] = "non_conservative_simple";
39 convection_op_options_[1] = "non_conservative_rhou";
40 convection_op_options_[2] = "conservative";
41 }
43
44 prefix_ = Nom("OpConv");
45 suffix_ = Nom("IJK_double");
46 is_cast_=false;
49}
50
51Sortie& Operateur_IJK_faces_conv::printOn( Sortie& os ) const
52{
53 // OWN_PTR(Operateur_IJK_faces_conv_base_double)::printOn( os );
55 return os;
56}
57
58Entree& Operateur_IJK_faces_conv::readOn( Entree& is )
59{
61 // By default, there is no testList using this...
62 // convection_option_ = convection_op_options_[0];
63 /*
64 * Does not work
65 * Once read the next word is no longer used to read the
66 * datafile
67 * Should we use empty brackets ?
68 * Yes but we need to modify every testfiles...
69 */
70 // search_convection_option_type(is);
71
72 /*
73 * Do not work because param.lire_sans_accolade
74 * does not work for non required params
75 */
76 // Param param(que_suis_je());
77 // set_param(param);
78 // param.lire_sans_accolade(is);
79 return is;
80}
81
83{
84 param.ajouter_non_std("velocity_convection_form", (this));
85}
86
88{
89 if (mot=="velocity_convection_form")
90 {
91 Motcle motlu;
92 is >> motlu;
94 Cerr << mot << " " << motlu << finl;
95 int option_rank = convection_op_options_.search(motlu);
96 if (option_rank < convection_op_options_.size() && option_rank !=-1)
98 else
100 }
101 else
103 return 1;
104}
105
107{
108 Cerr << "Read Operateur_IJK_faces_conv option:" << finl;
109 Motcle convection_option;
110 is >> convection_option;
111 Motcle word(convection_option);
113}
114
115void Operateur_IJK_faces_conv::set_convection_option_type( Motcle word ) // (const char * convection_op)
116{
117 int convection_option_index = convection_op_options_.search(word);
118 if (convection_option_index >= 0 && convection_option_index < convection_op_options_.size())
119 convection_option_ = convection_op_options_[convection_option_index];
120 else
122}
123
125{
126 Cerr << "Read and Cast Operateur_IJK_faces_conv :" << finl;
127 Motcle convection_op;
128 is >> convection_op;
129 Motcle word(convection_op);
130 Nom type(get_convection_op_type(word));
131 typer(type);
132 is_cast_=true;
133 return is;
134}
135
136void Operateur_IJK_faces_conv::typer_convection_op(const char * convection_op) // (const char * convection_op)
137{
138 Cerr << "Read and Cast Operateur_IJK_faces_conv :" << finl;
139 Motcle word(convection_op);
140 Nom type(get_convection_op_type(word));
141 typer(type);
142 is_cast_=true;
143}
144
145Nom Operateur_IJK_faces_conv::get_convection_op_type( Motcle word ) // (const char * convection_op)
146{
147
149 if (convection_option_rank_ == -1)
152
154 Nom type(prefix_);
155 switch(convection_rank_)
156 {
157 case 0 :
158 {
159 convection_op_ += "Amont";
160 break;
161 }
162 case 1 :
163 {
164 convection_op_ += "Centre4";
165 break;
166 }
167 case 2 :
168 {
169 convection_op_ += "Centre4";
170 break;
171 }
172 case 3 :
173 {
174 convection_op_ += "QuickSharp";
175 break;
176 }
177 case 4 :
178 {
179 convection_op_ += "QuickSharp";
180 break;
181 }
182 default :
183 {
184 Cerr << "ERROR : Scalar convection operators that are already implemented are:" << finl;
185 Cerr << convection_op_words_ << finl;
186 abort();
187 }
188 }
189 type += convection_op_;
190 type += suffix_;
191 return type;
192}
193
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
void set_param(Param &param) const override
void typer_convection_op(const char *convection_op)
int lire_motcle_non_standard(const Motcle &mot, Entree &is) override
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
Definition Param.cpp:489
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
Classe de base des flux de sortie.
Definition Sortie.h:52