TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Option_DG.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_DG.h>
17#include <Motcle.h>
18#include <Param.h>
19#include <SChaine.h>
20
21
23std::map<std::string, int> Option_DG::ORDERS = {};
25
26Implemente_instanciable(Option_DG,"Option_DG",Interprete);
27// XD Option_DG interprete Option_DG BRACE Class for DG options.
28
29
30Sortie& Option_DG::printOn(Sortie& os) const { return Interprete::printOn(os); }
31
32Entree& Option_DG::readOn(Entree& is) { return is; }
33
35{
36 //int vo=DEFAULT_ORDER+1, po=DEFAULT_ORDER, to=DEFAULT_ORDER; // Default orders for velocity, pressure, and temperature
37 int vo=-1, po=-1, to=-1; // Default orders for velocity, pressure, and temperature
38
39 Param param(que_suis_je());
40 param.ajouter("order",&DEFAULT_ORDER); // XD_ADD_P int
41 // XD_CONT global order for the DG unknowns (1 by default)
42 param.ajouter("velocity_order",&vo); // XD_ADD_P int
43 // XD_CONT optional order for DG velocity unknown
44 param.ajouter("pressure_order",&po); // XD_ADD_P int
45 // XD_CONT optional order for DG pressure unknown
46 param.ajouter("temperature_order",&to); // XD_ADD_P int
47 // XD_CONT optional order for DG temperature unknown
48 param.ajouter("gram_schmidt",&GRAM_SCHMIDT); // XD_ADD_P int
49 // XD_CONT Gram Schmidt orthogonalization (1 by default)
51
52 if (vo != -1)
53 {
54 ORDERS["vitesse"] = vo;
55 ORDERS["gradient_pression"] = vo;
56 }
57 if (to != -1)
58 ORDERS["temperature"] = to;
59 if (po != -1)
60 {
61 ORDERS["pression"] = po;
62 ORDERS["pression_pa"] = po;
63 ORDERS["divergence_U"] = po;
64 }
65
66 return is;
67}
68
69
71{
72 const std::string& s = n.getString();
73 if(ORDERS.count(s))
74 return ORDERS.at(s);
75 return DEFAULT_ORDER;
76}
77
78/*! @return the number of columns necessary in the unknown vector for a given
79 * method order. For example order 1 and 2D means we deal with the basis {1, X, Y}, so 3 cols.
80 */
81int Option_DG::Nb_col_from_order(const int order)
82{
83 int nb_cols = -1;
84 // Order
85 if (Objet_U::dimension == 2)
86 nb_cols = (order + 1)*(order + 2) / 2;
87 else // 3D
88 nb_cols = (order + 1)*(order + 2)*(order + 3) / 6;
89
90 return nb_cols;
91}
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
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const std::string & getString() const
Definition Nom.h:92
friend class Entree
Definition Objet_U.h:76
static int dimension
Definition Objet_U.h:99
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
This class enable to change options for DG computation in a .data file.
Definition Option_DG.h:32
static int Nb_col_from_order(const int order)
Definition Option_DG.cpp:81
Entree & interpreter(Entree &) override
Definition Option_DG.cpp:34
static int Get_order_for(const Nom &n)
Definition Option_DG.cpp:70
static std::map< std::string, int > ORDERS
Definition Option_DG.h:23
static int GRAM_SCHMIDT
Definition Option_DG.h:42
static int DEFAULT_ORDER
Definition Option_DG.h:41
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
Definition Param.cpp:32
Classe de base des flux de sortie.
Definition Sortie.h:52