TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Schema_Adams_Bashforth_order_2.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_order_2.h>
17#include <Equation_base.h>
18#include <TRUSTTrav.h>
19
20Implemente_instanciable(Schema_Adams_Bashforth_order_2,"Schema_Adams_Bashforth_order_2",Schema_Adams_Bashforth_base);
21// XD schema_adams_bashforth_order_2 schema_temps_base schema_adams_bashforth_order_2 INHERITS_BRACE not_set
22
24{
26}
27
29{
31}
32
33////////////////////////////////
34// //
35// Caracteristiques du schema //
36// //
37////////////////////////////////
38
39
40/*! @brief Renvoie le nombre de valeurs temporelles a conserver.
41 *
42 * Ici : n-1, n et n+1 donc 3.
43 *
44 */
49
50/*! @brief Renvoie le nombre de pas de temps strictement au dela duquel on applique le schema d Adams-Bahshforth.
51 *
52 * Ici : on a besoin d'au moins 1 temps du passe donc 0
53 *
54 */
56{
57 return 0 ;
58}
59
60/*! @brief Renvoie le nombre de valeurs temporelles du passe.
61 *
62 * Ici : n-1 donc 1.
63 *
64 */
66{
67 return 1 ;
68}
69
70/////////////////////////////////////////
71// //
72// Fin des caracteristiques du schema //
73// //
74/////////////////////////////////////////
75
77{
78 assert(times.size_array() == 3); //past, present and future times, stored in ascending order inside "times" table
79
80 if (coefficients().size_array() != 2)
81 {
82 coefficients().resize(2,RESIZE_OPTIONS::NOCOPY_NOINIT);
83 }
84
85 double past_time = times[0];
86 double present_time = times[1];
87 double future_time = times[2];
88 double past_time_step = present_time-past_time;
89
90 coefficients()[1] = 1./past_time_step;
91 coefficients()[1] *= (future_time+present_time-2*past_time);
92 coefficients()[1] *= 0.5;
93 assert(coefficients()[1] >= 0.);
94
95 coefficients()[0] = 1-coefficients()[1];
96 assert(coefficients()[0] <= 1.);
97}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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_Adams_Bashforth_base
const DoubleTab & coefficients() const override
classe Schema_Adams_Bashforth_order_2 Cette classe represente un schema en temps d'Adams-Bashforth d'...
int nb_pas_dt_seuil() const override
Renvoie le nombre de pas de temps strictement au dela duquel on applique le schema d Adams-Bahshforth...
int nb_valeurs_temporelles() const override
Renvoie le nombre de valeurs temporelles a conserver.
int nb_valeurs_passees() const override
Renvoie le nombre de valeurs temporelles du passe.
void compute_adams_bashforth_coefficients(double time_step, const DoubleTab &times) override
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size_array() const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469