TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Schema_Adams_Bashforth_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_Adams_Bashforth_base.h>
17#include <Equation_base.h>
18#include <Probleme_base.h>
19#include <TRUSTTrav.h>
20
21Implemente_base(Schema_Adams_Bashforth_base,"Schema_Adams_Bashforth_base",Schema_Explicite_Multi_TimeStep_base);
22
24{
26}
27
29{
31}
32
34{
36 // Loop on equations
37 for (int i=0; i<pb_base().nombre_d_equations(); i++)
39}
40
41void Schema_Adams_Bashforth_base::compute_coefficients(double time_step, const DoubleTab& times)
42{
44}
45
47{
49 {
50
51 const Equation_base& eqn_bis = ref_cast(Equation_base,eqn);
52 int i = 0;
53 int offset = 0;
54 double time_step = pas_de_temps(); //tn+1-tn
55
56 DoubleTab times(nb_valeurs_temporelles());
57
58 //Building of a time-in-ascending-order table
60
61 for (i=0; i<nb_valeurs_passees(); ++i)
62 {
63 offset = nb_valeurs_passees()-i;
64 times[i] = eqn_bis.inconnue().recuperer_temps_passe(offset); //past
65 }
66 times[nb_valeurs_passees()] = eqn_bis.inconnue().recuperer_temps_futur(0); //present
67 times[nb_valeurs_passees()+1] = eqn_bis.inconnue().recuperer_temps_futur(1); //future
68
69 compute_coefficients(time_step,times);
70
71 //Modification due to present time and past times
72 secmem*=coefficients()[nb_valeurs_passees()]; //present time
73
74 DoubleTrav dudt(eqn.inconnue().valeurs());
75 DoubleTrav tmp(dudt);
76 // Compute sum(coeff*dudt)
77 for (i=0; i<nb_valeurs_passees(); ++i)
78 {
79 offset = nb_valeurs_passees()-i;
80 tmp = eqn.derivee_en_temps().passe(offset);
81 tmp *= coefficients()[i];
82 dudt += tmp; //past time
83 }
84 // secmem+=Mdu/dt
85 eqn.solv_masse().ajouter_masse(1.,secmem,dudt,0);
86 }
87}
88
DoubleTab & passe(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.
double recuperer_temps_passe(int i=1) const
Retourne le temps du ieme champ passe.
double recuperer_temps_futur(int i=1) const
Retourne le temps du ieme champ futur.
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....
void set_calculate_time_derivative(int i)
Solveur_Masse_base & solv_masse()
Renvoie le solveur de masse associe a l'equation.
virtual const Champ_Inc_base & inconnue() const =0
virtual const Champ_Inc_base & derivee_en_temps() const
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 Probleme_base C'est un Probleme_U qui n'est pas un couplage.
virtual int nombre_d_equations() const =0
virtual const Equation_base & equation(int) const =0
classe Schema_Adams_Bashforth_base
void compute_coefficients(double time_step, const DoubleTab &times) override
void modifier_second_membre(const Equation_base &eqn, DoubleTab &secmem) override
virtual void compute_adams_bashforth_coefficients(double time_step, const DoubleTab &times)=0
void associer_pb(const Probleme_base &) override
const DoubleTab & coefficients() const override
classe Schema_Explicite_Multi_TimeStep_base
virtual int nb_valeurs_passees() const =0
virtual int nb_pas_dt_seuil() const =0
virtual void associer_pb(const Probleme_base &)
Probleme_base & pb_base()
double pas_de_temps() const
Renvoie le pas de temps (delta_t) courant.
int nb_pas_dt() const
Renvoie le nombre de pas de temps effectues.
virtual int nb_valeurs_temporelles() const =0
virtual Matrice_Base & ajouter_masse(double dt, Matrice_Base &matrice, int penalisation=1) const
Classe de base des flux de sortie.
Definition Sortie.h:52