TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Schema_Explicite_Multi_TimeStep_base.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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 <Schema_Explicite_Multi_TimeStep_base.h>
17#include <Domaine_Cl_dis_base.h>
18#include <Equation_base.h>
19#include <TRUSTTrav.h>
20#include <Debog.h>
21
22Implemente_base(Schema_Explicite_Multi_TimeStep_base,"Schema_Explicite_Multi_TimeStep_base",Schema_Temps_base);
23
25{
27}
28
30{
32}
33
34////////////////////////////////
35// //
36// Caracteristiques du schema //
37// //
38////////////////////////////////
39
40/*! @brief Renvoie le nombre de valeurs temporelles futures.
41 *
42 * Ici : n+1, donc 1.
43 *
44 */
49
50/*! @brief Renvoie le le temps a la i-eme valeur future.
51 *
52 * Ici : t(n+1)
53 *
54 */
56{
57 assert(i==1);
58 return temps_courant()+pas_de_temps();
59}
60
61/*! @brief Renvoie le le temps le temps que doivent rendre les champs a l'appel de valeurs()
62 *
63 * Ici : t(n+1)
64 *
65 */
70
71/////////////////////////////////////////
72// //
73// Fin des caracteristiques du schema //
74// //
75/////////////////////////////////////////
76
77/*! @brief Effectue un pas de temps d'Euler explicite sur l'equation passee en parametre.
78 *
79 * @param (Equation_base& eqn) l'equation que l'on veut faire avancer d'un pas de temps
80 * @return (int) renvoie toujours 1
81 */
83{
85
86 double time_step = pas_de_temps(); //tn+1-tn
87 double inv_time_step = 1/time_step;
88
89 // Un
90 const DoubleTab& present = eqn.inconnue().valeurs();
91 Debog::verifier("Schema_Explicite_Multi_TimeStep_base::faire_un_pas_de_temps_eqn_base, present",present);
92
93 // Un+1
94 DoubleTab& futur = eqn.inconnue().futur();
95
96 // sert pour la pression et les couplages
98
99 DoubleTab dudt(futur);
100 /*
101 if (nb_pas_dt() > nb_pas_dt_seuil())
102 {
103 Cout <<"Use of "<<que_suis_je()<<" scheme"<<finl;
104 }
105 else
106 {
107 Cout <<"Use of explicit Euler scheme for time step "<<nb_pas_dt()<<" in "<<que_suis_je()<<" scheme"<<finl;
108 } */
109
110 // Compute du/dt
111 eqn.derivee_en_temps_inco(dudt);
112
113 //Contribution de l'inconnue au temps n
114 futur = dudt;
115 futur *= time_step;
116 futur += present;
117
118 dudt=futur;
119 dudt-=present;
120 dudt*=inv_time_step;
121
122 Debog::verifier("Schema_Explicite_Multi_TimeStep_base::faire_un_pas_de_temps_eqn_base, dudt",dudt);
123
125 update_critere_statio(dudt, eqn);
127
128 //Debog::verifier("Schema_Explicite_Multi_TimeStep_base::faire_un_pas_de_temps_eqn_base, futur fin",futur);
129 return 1;
130}
131
133{
134 Nom equation_name(eqn.que_suis_je());
135 bool authorized = true;
136
137 authorized &= (bool) equation_name.find("FT");
138 authorized &= (bool) equation_name.find("Front_Tracking");
139 authorized &= (bool) equation_name.find("QC");
140 authorized &= (bool) equation_name.find("Quasi_Compressible");
141
142 if (!authorized)
143 {
144 Cerr<<"Error in "<<que_suis_je()<<"::authorized_equation()"<<finl;
145 Cerr<<"Equation "<<equation_name<<" is not allowed with "<<que_suis_je()<<" time scheme"<<finl;
147 }
148}
149
151{
152 Nom equation_name(eqn.que_suis_je());
153 bool authorized = true;
154
155 authorized &= (bool) equation_name.find("FT");
156 authorized &= (bool) equation_name.find("Front_Tracking");
157 authorized &= (bool) equation_name.find("QC");
158 authorized &= (bool) equation_name.find("Quasi_Compressible");
159
160 if (!authorized)
161 {
162 Cerr<<"Error in "<<que_suis_je()<<"::authorized_equation()"<<finl;
163 Cerr<<"Equation "<<equation_name<<" is not allowed with "<<que_suis_je()<<" time scheme"<<finl;
165 }
166}
DoubleTab & futur(int i=1) override
Renvoie les valeurs du champs a l'instant t+i.
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
static void verifier(const char *const msg, double)
Definition Debog.cpp:21
virtual void imposer_cond_lim(Champ_Inc_base &, double)=0
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Equation_base Le role d'une equation est le calcul d'un ou plusieurs champs....
virtual const Champ_Inc_base & inconnue() const =0
virtual DoubleTab & derivee_en_temps_inco(DoubleTab &)
Returns the time derivative of the unknown I of the equation: dI/dt = M-1*(sum(operators(I) + sources...
virtual Domaine_Cl_dis_base & domaine_Cl_dis()
Renvoie le domaine des conditions aux limite discretisee associee a l'equation.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
virtual int find(const char *const n) const
Definition Nom.cpp:314
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 void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
classe Schema_Explicite_Multi_TimeStep_base
double temps_defaut() const override
Renvoie le le temps le temps que doivent rendre les champs a l'appel de valeurs().
int faire_un_pas_de_temps_eqn_base(Equation_base &) override
Effectue un pas de temps d'Euler explicite sur l'equation passee en parametre.
int nb_valeurs_futures() const override
Renvoie le nombre de valeurs temporelles futures.
double temps_futur(int i) const override
Renvoie le le temps a la i-eme valeur future.
class Schema_Temps_base
double temps_courant() const
Renvoie le temps courant.
double pas_de_temps() const
Renvoie le pas de temps (delta_t) courant.
void update_critere_statio(const DoubleTab &tab_critere, Equation_base &equation)
//Actualisation de stationnaire_atteint_ et residu_ (critere residu_<seuil_statio_)
Classe de base des flux de sortie.
Definition Sortie.h:52
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")