TrioCFD 1.9.9_beta
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
class Discretisation_base This class represents a spatial discretization scheme, which
virtual bool is_poly_family() const
virtual bool is_ef() const
virtual bool is_vdf() const
class Discretiser Discretizes a problem:
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
Base class for "interpreter" objects.
Definition Interprete.h:38
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
friend class Entree
Definition Objet_U.h:71
static int dimension
Definition Objet_U.h:94
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
static int bidim_axi
Definition Objet_U.h:97
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Probleme_Couple This is the historical coupling class of TRUST.
virtual void discretiser(Discretisation_base &)
Associates a discretization with all problems of the coupled problem.
virtual const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the coupled problems (const version).
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Probleme_U.h:109
class Probleme_base It is a Probleme_U that is not a coupling.
virtual void discretiser(Discretisation_base &)
Assigns a discretization to the problem Discretizes the Domain associated with the problem with the d...
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52