TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Pred_Cor.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 <Domaine_Cl_dis_base.h>
17#include <Operateur_Conv.h>
18#include <Pred_Cor.h>
19
20Implemente_instanciable(Pred_Cor,"Schema_Predictor_Corrector",Schema_Temps_base);
21// XD schema_predictor_corrector schema_temps_base schema_predictor_corrector INHERITS_BRACE This is the
22// XD_CONT predictor-corrector scheme (second order). It is more accurate and economic than MacCormack scheme. It gives
23// XD_CONT best results with a second ordre convective scheme like quick, centre (VDF).
24
26{
28}
29
31{
33}
34
35
36////////////////////////////////
37// //
38// Caracteristiques du schema //
39// //
40////////////////////////////////
41
42
43/*! @brief Renvoie le nombre de valeurs temporelles a conserver.
44 *
45 * Ici : n et n+1, donc 2.
46 *
47 */
49{
50 return 2 ;
51}
52
53/*! @brief Renvoie le nombre de valeurs temporelles futures.
54 *
55 * Ici : n+1, donc 1.
56 *
57 */
59{
60 return 1 ;
61}
62
63/*! @brief Renvoie le le temps a la i-eme valeur future.
64 *
65 * Ici : t(n+1)
66 *
67 */
68double Pred_Cor::temps_futur(int i) const
69{
70 assert(i==1);
71 return temps_courant()+pas_de_temps();
72}
73
74/*! @brief Renvoie le le temps le temps que doivent rendre les champs a l'appel de valeurs()
75 *
76 * Ici : t(n+1)
77 *
78 */
80{
81 return temps_courant()+pas_de_temps();
82}
83
84/////////////////////////////////////////
85// //
86// Fin des caracteristiques du schema //
87// //
88/////////////////////////////////////////
89
90
92{
93 DoubleTab& xi=eqn.inconnue().valeurs();
94 DoubleTab& xipls1=eqn.inconnue().futur();
95
96 DoubleTab dudt(xi);
97
98 // Etape PREDICTOR
99
101
102 // On tourne la roue pour que les operateurs utilisent les champs au temps futur
103 eqn.inconnue().avancer();
104 eqn.derivee_en_temps_inco(dudt);
105
106 // Xi+1=Xi+dt_*dX/dt(Xi)
107 xipls1 = dudt;
108 xipls1 *= dt_;
109 xipls1 += xi;
110
111 xipls1.echange_espace_virtuel();
112
113 // Etape CORRECTOR
114 DoubleTab dudtpls1(xipls1);
115 eqn.derivee_en_temps_inco(dudtpls1);
116 eqn.inconnue().reculer();
117
118 dudtpls1 += dudt;
119 dudtpls1 *= 0.5;
120
121 // Xi+1=Xi+dt_*0.5*(dX/dt(Xi)+dX/dt(Xi+1))
122 xipls1 = dudtpls1 ;
123 xipls1 *= dt_;
124 xipls1 += xi ;
125
127 update_critere_statio(dudtpls1, eqn);
128
129 return 1;
130}
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
class Pred_Cor Le schema doit etre utilise avec un schema d'espace alternant
Definition Pred_Cor.h:28
int faire_un_pas_de_temps_eqn_base(Equation_base &) override
Definition Pred_Cor.cpp:91
double temps_defaut() const override
Renvoie le le temps le temps que doivent rendre les champs a l'appel de valeurs().
Definition Pred_Cor.cpp:79
double temps_futur(int i) const override
Renvoie le le temps a la i-eme valeur future.
Definition Pred_Cor.cpp:68
int nb_valeurs_futures() const override
Renvoie le nombre de valeurs temporelles futures.
Definition Pred_Cor.cpp:58
int nb_valeurs_temporelles() const override
Renvoie le nombre de valeurs temporelles a conserver.
Definition Pred_Cor.cpp:48
class Schema_Temps_base
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
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")