TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Simple.h
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
17#ifndef Simple_included
18#define Simple_included
19
20#include <TRUSTTabs_forward.h>
21#include <Simpler_Base.h>
22
23class Operateur_Grad ;
24
25//Description
26
27//Ref. International Journal For Numerical Methods In Fluids Vol. 12 P. 81-92
28// C. T. Shaw
29
30// A = (M/dt + C(Uk) + D)
31// Bt and -B denote the gradient and divergence operators respectively
32
33// A solution (U,P) is sought in the form:
34// U = U* + u'
35// P = P* + p'
36// where (U*,P*) satisfies the momentum equation and (u',p') is a correction
37// applied to satisfy the continuity equation.
38
39// (U*,P*) satisfies the momentum equation:
40// A[Uk-1]U*k = -BtP* + Sv + Ss + (M/dt)Uk-1 -> U*k
41//
42// Subtracting this from the full momentum equation for (U,P) gives an equation on u' and p':
43// A[Uk-1]u' = -Btp'
44
45// Keeping only the diagonal part (Da) of A, this becomes:
46// u' = -Da-1Btp'
47
48// The full velocity field U satisfies the continuity equation, giving:
49// -Bu' = BU*
50// hence (BDa-1Bt)p' = BU* -> p' then u'
51
52// At the end of the iteration, the solution is:
53// U = U* + beta_u u'
54// P = P* + beta_p p'
55// beta_u and beta_p are relaxation coefficients between 0 and 1.
56// In practice, relaxation is applied only to the pressure.
57
58// The algorithm can be repeated until convergence ||Uk-Uk-1|| < seuil_convergence_implicite_.
59// In practice, only one iteration is needed (seuil_convergence_implicite_ = 1e6).
60
61
62class Simple : public Simpler_Base
63{
64 Declare_instanciable_sans_constructeur(Simple);
65
66public :
67
68 Simple();
69 bool iterer_eqn(Equation_base& equation, const DoubleTab& inconnue, DoubleTab& result, double dt, int numero_iteration, int& ok) override;
70 void iterer_NS(Equation_base&, DoubleTab& current, DoubleTab& pression, double, Matrice_Morse&, double, DoubleTrav&,int nb_iter,int& converge, int& ok) override;
71 bool iterer_eqs(LIST(OBS_PTR(Equation_base)) eqs, int compteur, int& ok) override;
72
73 /* memoization of iterer_eqs: public so that the iterated power of TRUST-NK can share it */
74 using list_of_eq_ptr_t = std::vector<intptr_t>; // a list of pointers to equations.
75 std::map<list_of_eq_ptr_t, Matrice_Bloc> mbloc;
76
77protected :
78
79 DoubleTab Ustar_old; // U* = alpha_ U*_new + (1-alpha_)*U*_old in practice alpha = 1
80 double alpha_,beta_; // beta_ : pressure relaxation coefficient P = P* + beta_*P' 0<beta_<=1
82
83 Entree& lire(const Motcle&, Entree&) override;
84 void calculer_correction_en_vitesse(const DoubleTrav& correction_en_pression, DoubleTrav& gradP, DoubleTrav& correction_en_vitesse,const Matrice_Morse& matrice, const Operateur_Grad& gradient );
85
86};
87
88void diviser_par_rho_np1_face(Equation_base& eqn, DoubleTab& tab);
89
90#endif
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....
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
A character string (Nom) in uppercase.
Definition Motcle.h:26
Classe Operateur_Grad Generic class of the hierarchy of operators computing the gradient.
std::map< list_of_eq_ptr_t, Matrice_Bloc > mbloc
Definition Simple.h:75
double beta_
Definition Simple.h:80
int with_d_rho_dt_
Definition Simple.h:81
void iterer_NS(Equation_base &, DoubleTab &current, DoubleTab &pression, double, Matrice_Morse &, double, DoubleTrav &, int nb_iter, int &converge, int &ok) override
Definition Simple.cpp:576
double alpha_
Definition Simple.h:80
Entree & lire(const Motcle &, Entree &) override
Definition Simple.cpp:56
DoubleTab Ustar_old
Definition Simple.h:79
bool iterer_eqs(LIST(OBS_PTR(Equation_base)) eqs, int compteur, int &ok) override
Definition Simple.cpp:374
void calculer_correction_en_vitesse(const DoubleTrav &correction_en_pression, DoubleTrav &gradP, DoubleTrav &correction_en_vitesse, const Matrice_Morse &matrice, const Operateur_Grad &gradient)
Definition Simple.cpp:535
Simple()
Definition Simple.cpp:38
std::vector< intptr_t > list_of_eq_ptr_t
Definition Simple.h:74
bool iterer_eqn(Equation_base &equation, const DoubleTab &inconnue, DoubleTab &result, double dt, int numero_iteration, int &ok) override
Definition Simple.cpp:177