TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Discretiser.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 <Discretisation_base.h>
17#include <Probleme_Couple.h>
18#include <Probleme_base.h>
19#include <Discretiser.h>
20
21Implemente_instanciable(Discretiser,"Discretiser|Discretize",Interprete);
22// XD discretize interprete discretiser INHERITS_BRACE Keyword to discretise a problem problem_name according to the
23// XD_CONT discretization dis. NL2 IMPORTANT: A number of objects must be already associated (a domain, time scheme,
24// XD_CONT central object) prior to invoking the Discretize (Discretiser) keyword. The physical properties of this
25// XD_CONT central object must also have been read.
26// XD attr problem_name ref_pb_gen_base problem_name REQ Name of problem.
27// XD attr dis ref_discretisation_base dis REQ Name of the discretization object.
28
29
30//int Discretiser::is_deja_appele=0;
31
32Sortie& Discretiser::printOn(Sortie& os) const { return Interprete::printOn(os); }
33
35
37{
38saisie :
39 Nom nom1, nom2;
40 is >> nom1 >> nom2;
41 Objet_U& ob1=objet(nom1);
42 Objet_U& ob2=objet(nom2);
43
44 /* PL: What is this warning ?
45 if (is_deja_appele == 0) is_deja_appele = 1;
46 else
47 {
48 Cerr<<"Be careful, you call several times the interpreter Discretiser"<<finl;
49 Cerr<<"there is probably an error in your data set"<<finl;
50 // Process::exit();
51 }
52 */
53
54 if( !( sub_type(Discretisation_base, ob2) ) )
55 {
56 Cerr << nom2 << "is not a recognized discretization" << finl;
58 }
59 Discretisation_base& typ=ref_cast(Discretisation_base, ob2);
60 Cerr << "The chosen discretization is of type " << typ.que_suis_je() << finl;
61
62 if (bidim_axi == 1 && dimension == 2 && !typ.is_vdf() && !typ.is_poly_family() && !typ.is_ef())
63 {
64 Cerr << "The feature 'bidim_axi' is only available for 2D calculation with VDF, EF and PolyMAC_CDO(s) discretisations." << finl;
66 }
67
68 if( sub_type(Probleme_base, ob1) )
69 {
70 Probleme_base& pb=ref_cast(Probleme_base,ob1);
71 if(!pb.schema_temps().lu())
72 {
73 Cerr << "it must have read the time scheme before to discretize" << finl;
75 }
76 Cerr << "The chosen time scheme is of type " << pb.schema_temps().que_suis_je() << finl;
77 Cerr << "We treat the problem " << pb.le_nom() << " of type " << pb.que_suis_je() << finl;
78 Cerr << "Discretization of " << pb.le_nom() << " in progress..." << finl;
79 pb.discretiser(typ);
80 }
81 else if( sub_type(Probleme_Couple, ob1) )
82 {
83 Probleme_Couple& pbc=ref_cast(Probleme_Couple,ob1);
84 if(!pbc.schema_temps().lu())
85 {
86 Cerr << "it must have read the time scheme before to discretize" << finl;
88 }
89 Cerr << "The chosen time scheme is of type " << pbc.schema_temps().que_suis_je() << finl;
90 Cerr << "We treat the problem " << pbc.le_nom() << " of type " << pbc.que_suis_je() << finl;
91 Cerr << "It corresponds to the coupling of the following problems: " << finl;
92 for(int i=0; i< pbc.nb_problemes(); i++)
93 Cerr << " " << pbc.probleme(i).le_nom() << " of type " << pbc.probleme(i).que_suis_je() << finl;
94 Cerr << "Discretization of " << pbc.le_nom() << " in progress..." << finl;
95 pbc.discretiser(typ);
96 }
97 else
98 {
99 Cerr << "It is not known discretize a : " << ob1.que_suis_je() << finl;
100 Cerr << "return at the seizure of the arguments" << finl;
101 goto saisie;
102 }
103 return is;
104}
const Probleme_U & probleme(int i) const
Definition Couplage_U.h:127
int nb_problemes() const
Definition Couplage_U.h:117
classe Discretisation_base Cette classe represente un schema de discretisation en espace,...
virtual bool is_poly_family() const
virtual bool is_ef() const
virtual bool is_vdf() const
classe Discretiser Discretise un probleme:
Definition Discretiser.h:32
Entree & interpreter(Entree &) override
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
static Objet_U & objet(const Nom &)
Voir Interprete_bloc::objet_global() BM: la classe Interprete n'est pas le meilleur endroit pour cett...
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55
static int bidim_axi
Definition Objet_U.h:102
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
classe Probleme_Couple C'est la classe historique de couplage de TRUST.
virtual void discretiser(Discretisation_base &)
Associe une discretisation a tous les problemes du probleme couple.
virtual const Schema_Temps_base & schema_temps() const
Renvoie le schema en temps associe aux problemes couples.
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Probleme_U.h:109
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
virtual void discretiser(Discretisation_base &)
Affecte une discretisation au probleme Discretise le Domaine associe au probleme avec la discretisati...
const Schema_Temps_base & schema_temps() const
Renvoie le schema en temps associe au probleme.
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