TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Piso.h
1/****************************************************************************
2* Copyright (c) 2026, 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#ifndef Piso_included
17#define Piso_included
18
19#include <Navier_Stokes_std.h>
20#include <Simpler.h>
21
22//Description
23
24// Ref. Journal of Computational Physics 62 P. 40-65
25// R. I. Issa
26
27// A = (M/dt + C(Uk) + D)
28// Bt and -B denote the gradient and divergence operators respectively
29// delta_x denotes the Laplacian operator
30// H denotes the convection+diffusion operator
31
32// The PISO (Pressure Implicit Splitting Operator) algorithm is non-iterative
33// and consists of three steps * ** and ***.
34// The steps of the algorithm are:
35
36// -PREDICTION STEP
37//
38// Find the velocity field U* satisfying the momentum equation (with pressure Pn)
39// (rho/dt)*(U*-Un) = H(U*) - BtP + S
40// U* does not satisfy the continuity equation
41
42// The prediction step is performed by solving the following system:
43// AU* = -BtPn + Sv + Ss + (M/dt)Un -> U*
44
45
46// -FIRST CORRECTION STEP
47//
48// Find U** and P* satisfying the momentum equation and continuity equation (from U* and Un)
49// (rho/dt)*(U**-Un) = H(U*) - BtP* + S
50// delta_x U** = 0
51
52// To stabilise the system, the diagonal part of convection-diffusion is treated implicitly
53// (rho/dt-Ao)*U** - (rho/dt)*Un = H'(U*) -BtP* + S with H(U) = H'(U) + AoU
54// Subtracting the prediction equation:
55// (rho/dt-Ao)*(U**-U*) = -Bt(P*-Pn) and on the other hand delta_x U** = 0
56//
57// The first correction step is performed by solving (Da = rho/dt-Ao):
58// (BDa-1Bt)P' = BU* -> P' -> P* = Pn + P'
59// then Da[Un]U' = -BtP' -> U' -> U** = U* + U'
60
61
62//-SECOND CORRECTION STEP
63//
64// Find U*** and P** satisfying the momentum equation and continuity equation (from U** and Un)
65// (rho/dt)*(U***-Un) = H(U**) - BtP** + S
66// delta_x U*** = 0
67
68// To stabilise the system, the diagonal part of convection-diffusion is treated implicitly
69// (rho/dt-Ao)*U*** - (rho/dt)*Un = H'(U**) -BtP** + S
70// Subtracting the reformulated first correction equation from the reformulated second correction equation:
71// (rho/dt-Ao)*(U***-U**) = H'(U**-U*) -Bt(P**-P*) and on the other hand delta_x U*** = 0 and delta_x U** = 0
72//
73// The second correction step is performed by solving (E = H'):
74// (BDa-1Bt)P'' = (BDa-1E)U' -> P'' -> P** = P* + P''
75// DaU'' = EU' -BtP'' -> U'' -> U*** = U** + U''
76
77// Note: Additional correction steps can be performed.
78// The implementation here continues corrections (compt_max-1 maximum)
79// unless the residual increases compared to the previous correction.
80
81class Piso : public Simpler
82{
83 Declare_instanciable(Piso);
84public :
85 void iterer_NS(Equation_base&, DoubleTab& current, DoubleTab& pression, double, Matrice_Morse&, double, DoubleTrav&,int nb_iter,int& converge, int& ok) override;
86protected :
87
88 int nb_corrections_max_ = 21; // maximum number of corrections to refine the projection
89 int avancement_crank_ = 0; // not pure PISO but rather Crank-Nicolson
90 int with_sources_ = 0; // include source terms in the pressure matrix -> more implicit terms, fewer PISO terms
91
92 Entree& lire(const Motcle&, Entree&) override;
93
94private:
95 virtual void iterer_NS_PolyMAC_CDO(Navier_Stokes_std& eqn,DoubleTab& current,DoubleTab& pression, double dt, Matrice_Morse& matrice, int& ok);
96 // IBM stuff
97 void add_penality_term(Navier_Stokes_std& , DoubleTrav& resu , DoubleTrav& gradP);
98 void correct_incr_pressure(Navier_Stokes_std& , DoubleTrav& secmem);
99 void correct_gradP(Navier_Stokes_std& , DoubleTrav& gradP);
100 void correct_pressure(Navier_Stokes_std& , DoubleTab& , DoubleTab& );
101};
102
103//Description
104// Ref. G. Fauchet
105
106// The IMPLICITE algorithm is non-iterative and consists of two steps * and **.
107// The steps of the algorithm are:
108
109// -PREDICTION STEP
110//
111// Find the velocity field U* satisfying the momentum equation (with pressure Pn)
112// As in the PISO algorithm, the diffusion term is expressed implicitly
113// and the convection term semi-implicitly.
114
115// (U*-Un)/dt = H(U*) - BtPn + Sv + Ss
116// U* does not satisfy the continuity equation
117
118// The prediction step is performed by solving the following system:
119// AU* = -BtPn + Sv + Ss + (M/dt)Un -> U*
120
121// -CORRECTION STEP
122//
123// The momentum equation at step n+1 can be written:
124// (Un+1-Un)/dt = H(Un+1) - BtPn+1 + Sv + Ss
125// Subtracting the momentum equation written for U* and neglecting
126// the convection and diffusion terms on U' = Un+1 - U*, we get:
127// (Un+1-U*)/dt = -BtP' with P' = Pn+1 - Pn
128//
129// The correction step is performed by solving (M = mass matrix):
130// (BM-1Bt)dt*P' = BU* -> dt*P' -> P'
131// Un+1 = U* -dt*BtP' -> Un+1
132//
133// Note: The mass matrix is constant, therefore the system (BM-1Bt) is assembled only once.
134class Implicite : public Piso
135{
136 Declare_instanciable(Implicite);
137};
138
139#endif /* Piso_included */
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
Navier_Stokes_std This class carries the terms of the momentum equation.
Definition Piso.h:82
int avancement_crank_
Definition Piso.h:89
int nb_corrections_max_
Definition Piso.h:88
Entree & lire(const Motcle &, Entree &) override
Definition Piso.cpp:60
int with_sources_
Definition Piso.h:90
void iterer_NS(Equation_base &, DoubleTab &current, DoubleTab &pression, double, Matrice_Morse &, double, DoubleTrav &, int nb_iter, int &converge, int &ok) override
Definition Piso.cpp:118