TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Option_VDF.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <Option_VDF.h>
17#include <Motcle.h>
18#include <Param.h>
19
20Implemente_instanciable(Option_VDF, "Option_VDF", Interprete);
21// XD option_vdf interprete option_vdf BRACE Class of VDF options.
22
27
28Sortie& Option_VDF::printOn(Sortie& os) const { return Interprete::printOn(os); }
30
32{
33 Param param(que_suis_je());
34 param.ajouter_non_std("traitement_coins", (this)); // XD_ADD_P chaine(into=["oui","non"])
35 // XD_CONT Treatment of corners (yes or no). This option modifies slightly the calculations at the outlet of the plane
36 // XD_CONT channel. It supposes that the boundary continues after channel outlet (i.e. velocity vector remains
37 // XD_CONT parallel to the boundary).
38 param.ajouter_non_std("traitement_gradients", (this)); // XD_ADD_P chaine(into=["oui","non"])
39 // XD_CONT Treatment of gradient calculations (yes or no). This option modifies slightly the gradient calculation at
40 // XD_CONT the corners and activates also the corner treatment option.
41 param.ajouter_non_std("P_imposee_aux_faces", (this)); // XD_ADD_P chaine(into=["oui","non"])
42 // XD_CONT Pressure imposed at the faces (yes or no).
43 param.ajouter_non_std("DEACTIVATE_ARETE_MIXTE", (this)); // XD_ADD_P rien
44 // XD_CONT Deactivate the arete_mixte contribution in the conv op of the momentum equation.
45 param.ajouter_non_std("all_options|toutes_les_options", (this)); // XD_ADD_P rien
46 // XD_CONT Activates all Option_VDF options. If used, must be used alone without specifying the other options, nor
47 // XD_CONT combinations.
49 return is;
50}
51
52int Option_VDF::test_mot(const Motcle& mot_cle, const Motcle& mot_lu) const
53{
54 if (all_options_)
55 {
56 Cerr << "Error in Option_VDF::" << __func__ << " !!!!!!!!!!!!" << finl;
57 Cerr << "You can not activate the option : " << mot_cle << " because the keyword all_options|toutes_les_options is already specified. Remove one of them !" << finl;
59 }
60
61 Motcles les_mots(2);
62 les_mots[0] = "non";
63 les_mots[1] = "oui";
64
65 int rang = les_mots.search(mot_lu);
66 if (rang == -1)
67 {
68 Cerr << "Error in Option_VDF::" << __func__ << " !!!!!!!!!!!!" << finl;
69 Cerr << "The tested keyword is " << mot_lu << ", while we expected a keyword among the following : oui/non" << finl;
70 throw;
71 }
72 else return rang; /* 0 si non et 1 si oui */
73}
74
76{
77 Motcle mot_lu;
78 int retval = 1;
79
80 if (mot_cle == "traitement_coins")
81 {
82 is >> mot_lu;
83 if (test_mot(mot_cle, mot_lu))
84 {
85 Cerr << mot_cle << " : will affect the action of the method Domaine_Cl_VDF::completer ..." << finl;
87 }
88 }
89 else if (mot_cle == "traitement_gradients")
90 {
91 is >> mot_lu;
92 if (test_mot(mot_cle, mot_lu))
93 {
94 Cerr << mot_cle << " : will affect the gradient calculation at the corners ! This option activates also traitement_coins ..." << finl;
96 }
97 }
98 else if (mot_cle == "P_imposee_aux_faces")
99 {
100 is >> mot_lu;
101 if (test_mot(mot_cle, mot_lu))
102 {
103 Cerr << mot_cle << " : will affect the action of the operator gradient for Neumann_sortie_libre boundary condition and therefore the assembleur action will also be affected ..." << finl;
104 coeff_P_neumann = 2.;
105 }
106 }
107 else if (mot_cle == "DEACTIVATE_ARETE_MIXTE")
109 else if (mot_cle == "all_options" || mot_cle == "toutes_les_options") /* for experts only ;) */
110 {
111 Cerr << "Activating all VDF options ... This will affect the action of the method Domaine_Cl_VDF::completer, the gradient calculation at the corners and " << finl;
112 Cerr << "the action of the operator gradient for Neumann_sortie_libre boundary condition and therefore the assembleur action will also be affected ... " << finl;
113 all_options_ = true;
115 }
116 else
117 retval = -1;
118
119 return retval;
120}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe de base des objets "interprete".
Definition Interprete.h:38
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
Un tableau d'objets de la classe Motcle.
Definition Motcle.h:63
int search(const Motcle &t) const
Definition Motcle.cpp:321
friend class Entree
Definition Objet_U.h:76
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 int traitement_coins
Definition Option_VDF.h:30
Entree & interpreter(Entree &) override
int test_mot(const Motcle &mot_cle, const Motcle &mot_lu) const
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
static double coeff_P_neumann
Definition Option_VDF.h:31
static bool DEACTIVATE_ARETE_MIXTE
Definition Option_VDF.h:32
static int traitement_gradients
Definition Option_VDF.h:30
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
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
Definition Param.cpp:32
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