TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Operateur_IJK_elem_diff.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#include <Operateur_IJK_elem_diff.h>
16#include <Param.h>
17
18Implemente_instanciable_sans_constructeur( Operateur_IJK_elem_diff, "Operateur_IJK_elem_diff", OWN_PTR( Operateur_IJK_elem_diff_base_double ) );
19
20Operateur_IJK_elem_diff::Operateur_IJK_elem_diff()
21{
22 diffusion_op_words_ = Motcles(6);
23 {
24 diffusion_op_words_[0] = "standard";
25 diffusion_op_words_[1] = "uniform";
26 diffusion_op_words_[2] = "anisotropic";
27 diffusion_op_words_[3] = "vectorial";
28 diffusion_op_words_[4] = "vectorialanisotropic";
29 diffusion_op_words_[5] = "structural";
30 }
31 prefix_ = Nom("OpDiff");
32 suffix_ = Nom("IJKScalar_double");
33 diffusion_op_ = "";
35 is_cast_ = false;
37}
38
46
47Sortie& Operateur_IJK_elem_diff::printOn(Sortie& os) const
48{
49 // OWN_PTR(Operateur_IJK_elem_diff_base_double)::printOn( os );
51 return os;
52}
53
54Entree& Operateur_IJK_elem_diff::readOn(Entree& is)
55{
57// Param param(que_suis_je());
58// set_param(param);
59// param.lire_sans_accolade(is);
60 return is;
61}
62
64{
65 param.ajouter_non_std("velocity_diffusion_form", (this));
66}
67
69{
70 return 1;
71}
72
74{
75 if (is_cast_)
77 Cerr << "Read and Cast Operateur_IJK_elem_diff :" << finl;
78 Motcle word;
79 is >> word;
80 Nom type(get_diffusion_op_type(word));
81 typer(type);
82 Cerr << "Operateur_IJK_elem_diff cast to " << type << finl;
83 is >> valeur();
84 is_cast_ = true;
85 return is;
86}
87
88void Operateur_IJK_elem_diff::typer_diffusion_op(const char *diffusion_op) // (const char * convection_op)
89{
90 if (is_cast_)
92 Cerr << "Read and Cast Operateur_IJK_elem_diff :" << finl;
93 Motcle word(diffusion_op);
94 Nom type(get_diffusion_op_type(word));
95 typer(type);
96 Cerr << "Operateur_IJK_elem_diff cast to " << type << finl;
97 is_cast_ = true;
98}
99
101{
102 Nom type(prefix_);
104 switch(diffusion_rank_)
105 {
106 case 0:
107 {
108 diffusion_op_ += "";
109 break;
110 }
111 case 1:
112 {
113 diffusion_op_ += "Uniform";
114 break;
115 }
116 case 2:
117 {
118 diffusion_op_ += "Anisotropic";
119 break;
120 }
121 case 3:
122 {
123 diffusion_op_ += "Vectorial";
124 break;
125 }
126 case 4:
127 {
128 diffusion_op_ += "VectorialAnisotropic";
129 break;
130 }
131 case 5:
132 {
133 diffusion_op_ += "StructuralOnly";
134 break;
135 }
136 default:
137 {
138 Cerr << "ERROR : Diffusion operators (elem) that are already implemented are:" << finl;
139 Cerr << diffusion_op_words_ << finl;
140 abort();
141 }
142 }
143 type += diffusion_op_;
144 type += suffix_;
145 typer(type);
146 return type;
147}
148
149void Operateur_IJK_elem_diff::set_conductivity_coefficient(const double& uniform_lambda, const IJK_Field_local_double& lambda, IJK_Field_local_double& coeff_field_x,
150 IJK_Field_local_double& coeff_field_y, IJK_Field_local_double& coeff_field_z)
151{
152 switch(diffusion_rank_)
153 {
154 case 0:
155 {
156 // Standard
157 valeur().set_lambda(lambda);
158 break;
159 }
160 case 1:
161 {
162 // Uniform
163 valeur().set_uniform_lambda(uniform_lambda);
164 break;
165 }
166 case 2:
167 {
168 // Anisotropic
169 valeur().set_coeff_x_y_z(coeff_field_x, coeff_field_y, coeff_field_z);
170 break;
171 }
172 case 3:
173 {
174 // Vectorial
175 valeur().set_coeff_x_y_z(coeff_field_x, coeff_field_y, coeff_field_z);
176 break;
177 }
178 case 4:
179 {
180 // VectorialAnisotropic
181 valeur().set_coeff_x_y_z(coeff_field_x, coeff_field_y, coeff_field_z);
182 break;
183 }
184 case 5:
185 {
186 // StructuralOnly
187 valeur().set_coeff_x_y_z(coeff_field_x, coeff_field_y, coeff_field_z);
188 break;
189 }
190 default:
191 {
192 Cerr << "ERROR : The conductivity can not be set properly" << finl;
193 abort();
194 }
195 }
196}
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
int lire_motcle_non_standard(const Motcle &mot, Entree &is) override
void typer_diffusion_op(const char *diffusion_op)
void set_param(Param &param) const override
void set_conductivity_coefficient(const double &uniform_lambda, const IJK_Field_local_double &lambda, IJK_Field_local_double &coeff_field_x, IJK_Field_local_double &coeff_field_y, IJK_Field_local_double &coeff_field_z)
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
Classe de base des flux de sortie.
Definition Sortie.h:52