TrioCFD 1.9.9_beta
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 Performs an explicit Euler time step on the equation passed as parameter.
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
Returns field values at instant t+i.
DoubleTab & valeurs() override
Returns the array of field values at the current time.
Champ_Inc_base & avancer(int i=1)
Advances the current pointer by i time steps, in the list of kept temporal values.
Champ_Inc_base & reculer(int i=1)
Rewinds the current pointer by i time steps, in the list of kept temporal values.
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
class Equation_base The role of an equation is the calculation of one or more fields....
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()
Returns the discretized boundary condition domain associated with the equation.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
: class Schema_Euler_explicite This class represents an explicit Euler time scheme: U(n+1) = U(n) + d...
int faire_un_pas_de_temps_eqn_base(Equation_base &) override
Performs an explicit Euler time step on the equation passed as parameter.
double temps_courant() const
Returns the current time.
double dt_
Computation time step.
double pas_de_temps() const
Returns the current time step (delta_t).
void update_critere_statio(const DoubleTab &tab_critere, Equation_base &equation)
Updates stationnaire_atteint_ and residu_ (criterion: residu_ < seuil_statio_).
Base class for output streams.
Definition Sortie.h:52