TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Schema_Backward_Differentiation_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_Backward_Differentiation_order_2.h>
17
18#include <Equation_base.h>
19#include <Probleme_base.h>
20#include <Probleme_Couple.h>
21#include <Milieu_base.h>
22#include <Param.h>
23
24#include <communications.h>
25#include <Matrice_Morse.h>
26
27Implemente_instanciable(Schema_Backward_Differentiation_order_2,"Schema_Backward_Differentiation_order_2",Schema_Backward_Differentiation_base);
28// XD schema_backward_differentiation_order_2 schema_implicite_base schema_backward_differentiation_order_2 INHERITS_BRACE not_set
29// XD attr facsec_max floattant facsec_max OPT Maximum ratio allowed between time step and stability time returned by
30// XD_CONT CFL condition. The initial ratio given by facsec keyword is changed during the calculation with the implicit
31// XD_CONT scheme but it couldn\'t be higher than facsec_max value.NL2 Warning: Some implicit schemes do not permit high
32// XD_CONT facsec_max, example Schema_Adams_Moulton_order_3 needs facsec=facsec_max=1. NL2 Advice:NL2 The calculation
33// XD_CONT may start with a facsec specified by the user and increased by the algorithm up to the facsec_max limit. But
34// XD_CONT the user can also choose to specify a constant facsec (facsec_max will be set to facsec value then). Faster
35// XD_CONT convergence has been seen and depends on the kind of calculation: NL2-Hydraulic only or thermal hydraulic
36// XD_CONT with forced convection and low coupling between velocity and temperature (Boussinesq value beta low), facsec
37// XD_CONT between 20-30NL2-Thermal hydraulic with forced convection and strong coupling between velocity and
38// XD_CONT temperature (Boussinesq value beta high), facsec between 90-100 NL2-Thermohydralic with natural convection,
39// XD_CONT facsec around 300NL2 -Conduction only, facsec can be set to a very high value (1e8) as if the scheme was
40// XD_CONT unconditionally stableNL2These values can also be used as rule of thumb for initial facsec with a facsec_max
41// XD_CONT limit higher.
42
43
44
45/*! @brief Simple appel a: Schema_Temps_base::printOn(Sortie& ) Ecrit le schema en temps sur un flot de sortie.
46 *
47 * @param (Sortie& s) un flot de sortie
48 * @return (Sortie&) le flot de sortie modifie
49 */
51{
53}
54
55
56/*! @brief Lit le schema en temps a partir d'un flot d'entree.
57 *
58 * Simple appel a: Schema_Temps_base::readOn(Entree& )
59 *
60 * @param (Entree& s) un flot d'entree
61 * @return (Entree&) le flot d'entree modifie
62 */
64{
66}
67
68////////////////////////////////
69// //
70// Caracteristiques du schema //
71// //
72////////////////////////////////
73
74
75/*! @brief Renvoie le nombre de valeurs temporelles a conserver.
76 *
77 * Ici : n-1, n et n+1 donc 3.
78 *
79 */
84
89
94
95/////////////////////////////////////////
96// //
97// Fin des caracteristiques du schema //
98// //
99/////////////////////////////////////////
100
102{
103 assert(times.size_array() == 3); //past, present and future times, stored in ascending order inside "times" table
104
105 if (backward_differentiation_coefficients_.size_array() != 3)
106 {
107 backward_differentiation_coefficients_.resize(3,RESIZE_OPTIONS::NOCOPY_NOINIT);
108 }
109
110 double alpha_0 = time_step/(times[2]-times[0]); // for times[0] which means past time
111 double alpha_1 = 1.; // for times[1] which means present time
112
113 backward_differentiation_coefficients_[2] = 1./(alpha_0+alpha_1); //for times[2] which means future time
114 backward_differentiation_coefficients_[1] = alpha_1*backward_differentiation_coefficients_[2]/(1.-alpha_0/alpha_1); //for times[1] which means present time
115 backward_differentiation_coefficients_[0] = alpha_0*backward_differentiation_coefficients_[2]/(1.-alpha_1/alpha_0); //for times[0] which means past time
116}
117
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_Backward_Differentiation_base
classe Schema_Backward_Differentiation_order_2 Cette classe represente un schema de differentiation r...
void compute_backward_differentiation_coefficients(double time_step, const DoubleTab &times) const override
int nb_valeurs_temporelles() const override
Renvoie le nombre de valeurs temporelles a conserver.
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size_array() const