TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Schema_Euler_explicite.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_Euler_explicite.h>
17#include <Equation_base.h>
18
19Implemente_instanciable(Schema_Euler_explicite,"Schema_euler_explicite|Scheme_euler_explicit",TRUSTSchema_RK<Ordre_RK::UN>);
20// XD euler_scheme schema_temps_base schema_euler_explicite INHERITS_BRACE This is the Euler explicit scheme.
21
23
25
26/*! @brief Effectue un pas de temps d'Euler explicite sur l'equation passee en parametre.
27 *
28 */
30{
31 DoubleTab& present = eqn.inconnue().valeurs(); // Un
32 DoubleTab& futur = eqn.inconnue().futur(); // Un+1
33 DoubleTrav dudt(futur); // just for initializing the array structure ... Trav is highly recommanded!! Otherwise we allocate at each time step!!
34
35 /*
36 * The strategy done in the explicit schemes is to prescribe CL at time n+1
37 * at the begining of the time step, turning the wheel (avancer/reculer) to use
38 * it in derivee_en_temps_inco (so that valeurs() points to futur() only for BC).
39 *
40 * It influences only two cases
41 * - Time dependent BCs (champ_fonc_txyz ou ICoCo) or function (champ_fonc_fonction) => Here it only shifts the
42 * applied BC by one time step, but does not change the order of the scheme
43 *
44 * - Coupled cases (paroi contact) => Here it is mandatory to have the equality of the fluxes at the coupled boundary
45 *
46 * See the out files of docond/docond_vef
47 */
48
49 // Boundary conditions applied on Un+1:
51
52 eqn.inconnue().avancer();
53 eqn.derivee_en_temps_inco(dudt);
54 eqn.inconnue().reculer();
55
56 // Un+1=Un+dt_*dU/dt
57 futur = dudt;
58 futur *= dt_;
59 futur += present;
60
62 update_critere_statio(dudt, eqn);
63
64 return 1;
65}
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.
Champ_Inc_base & avancer(int i=1)
Avance le pointeur courant de i pas de temps, dans la liste des valeurs temporelles conservees.
Champ_Inc_base & reculer(int i=1)
Recule le pointeur courant de i pas de temps, dans la liste des valeurs temporelles conservees.
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.
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
: classe Schema_Euler_explicite Cette classe represente un schema en temps d'Euler explicite: U(n+1) ...
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.
double temps_courant() const
Renvoie le temps courant.
double dt_
Pas de temps de calcul.
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