TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
IJK_Test_Multigrille.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 <IJK_Test_Multigrille.h>
17#include <Interprete_bloc.h>
18#include <IJK_tools.h>
19#include <Perf_counters.h>
20
21
22Implemente_instanciable(IJK_Test_Multigrille, "IJK_Test_Multigrille", Interprete);
23
25{
26 return s;
27}
28
30{
31 return s;
32}
33
35{
36 Domaine_IJK split;
37
38 Param param(que_suis_je());
39 Nom ijk_splitting_name;
40 Nom name_of_dom_;
41 param.ajouter("ijk_splitting", &ijk_splitting_name, Param::REQUIRED);
42 param.ajouter("multigrid_solver", &poisson_solver_, Param::REQUIRED);
43 param.ajouter("fichier_reprise_rhs", &fichier_reprise_rhs_);
44 param.ajouter("fichier_reprise_rho", &fichier_reprise_rho_);
45 param.ajouter("timestep_reprise_rhs", &timestep_reprise_rhs_);
46 param.ajouter("timestep_reprise_rho", &timestep_reprise_rho_);
47 param.ajouter("expression_rho", &expression_rho_);
48 param.ajouter("expression_rhs", &expression_rhs_);
49 param.ajouter("name_of_dom", &name_of_dom_);
50 param.lire_avec_accolades(is);
51
52 // Recuperation des donnees de maillage
53 split = ref_cast(Domaine_IJK, Interprete_bloc::objet_global(ijk_splitting_name));
54 statistics().create_custom_counter("timing_init",1,"IJK");
55 statistics().begin_count("timing_init",statistics().get_last_opened_counter_level()+1);
56 rho_.allocate(split, Domaine_IJK::ELEM, 0);
57 rhs_.allocate(split, Domaine_IJK::ELEM, 0);
58 resu_.allocate(split, Domaine_IJK::ELEM, 0);
59
60 if (expression_rho_!="??")
61 {
62 set_field_data(rho_, expression_rho_);
63 /* Nom lata_name("rho.lata");
64 dumplata_header(lata_name,rho_);
65 //dumplata_add_geometry(lata_name,rho_);
66 dumplata_newtime(lata_name,0.);
67 dumplata_scalar(lata_name,"RHO",rho_,0);
68 */
69 }
70 else if (fichier_reprise_rho_ != "??")
71 {
72 lire_dans_lata(fichier_reprise_rho_, timestep_reprise_rho_, name_of_dom_, "RHO", rho_);
73 }
74
75 Cout<<"End of setting rho"<<finl;
76 if (expression_rhs_!="??")
77 {
78 set_field_data(rhs_, expression_rhs_);
79 }
80 else if (fichier_reprise_rhs_ != "??")
81 {
82 lire_dans_lata(fichier_reprise_rhs_, timestep_reprise_rhs_, name_of_dom_, "PRESSURE_RHS", rhs_);
83 }
84 Cout<<"End of setting rhs"<<finl;
85 double t0 = statistics().get_time_since_last_open("timing_init");
86 statistics().end_count("timing_init");
87 statistics().begin_count("timing_init",statistics().get_last_opened_counter_level()+1);
88 poisson_solver_.initialize(split);
89 double t0b = statistics().get_time_since_last_open("timing_init");
90 statistics().end_count("timing_init");
91 Cout <<"initialisation time "<<t0<< " "<<t0b<<finl;
92 statistics().create_custom_counter("timing_set_rho",1,"IJK");
93 statistics().create_custom_counter("timing_solve",1,"IJK");
94 statistics().begin_count("timing_set_rho",statistics().get_last_opened_counter_level()+1);
95 poisson_solver_.set_rho(rho_);
96 double t1 = statistics().get_time_since_last_open("timing_set_rho");
97 statistics().end_count("timing_set_rho");
98
99 statistics().begin_count("timing_solve",statistics().get_last_opened_counter_level()+1);
100 poisson_solver_.resoudre_systeme_IJK(rhs_, resu_);
101 double t2 = statistics().get_time_since_last_open("timing_solve");
102 statistics().end_count("timing_solve");
103
104 /* */
105 Nom lata_name("resu.lata");
106 dumplata_header(lata_name,resu_);
107 dumplata_add_geometry(lata_name,resu_);
108 dumplata_newtime(lata_name,0.);
109 dumplata_scalar(lata_name,"RESU",resu_,0);
110 dumplata_scalar(lata_name,"PRESSURE_RHS",rhs_,0);
111 dumplata_scalar(lata_name,"RHO",rho_,0);
112 /* */
113
114#if defined WITH_SSE
115 Nom optim("SSE");
116#elif defined WITH_AVX
117 Nom optim("AVX");
118#else
119 Nom optim("DISABLED");
120#endif
121
122 Cout << "Timing for Poisson resolution (vectorization " << optim << " ): set_rho: " << t1 << " solve: " << t2 << finl;
123
124 return is;
125}
This class encapsulates all the information related to the eulerian mesh for TrioIJK.
Definition Domaine_IJK.h:47
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Entree & interpreter(Entree &) override
Multigrille_Adrien poisson_solver_
static Objet_U & objet_global(const Nom &nom)
cherche l'objet demande dans l'Interprete_bloc courant (Interprete_bloc::interprete_courant()) et dan...
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
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
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
@ REQUIRED
Definition Param.h:115
int lire_avec_accolades(Entree &is)
Alias of lire_avec_accolades_depuis.
Definition Param.h:577
Classe de base des flux de sortie.
Definition Sortie.h:52