Vous êtes sur la page 1sur 84

Université Mohammed Premier Oujda

Faculté Pluridisciplinaire de Nador


Département de Physique

Cours de la Méthode des


Différences Finies

Master : GNSS

Professeur : Dr. Driss BAHIA

1
Introduction
Dans la nature, les systèmes et les phénomènes physiques sont
régis par des équations et les phénomènes physiques les plus
intéressants sont aussi les plus complexes à étudier. Ils sont
souvent régis par un grand nombre de paramètres non-
linéaires interagissant entre eux (la météorologie, la turbulence
des fluides...).
Pour comprendre ou étudier ces phénomènes :
1. L’une des solutions est l’expérience pour analyser les
paramètres et les grandeurs du système, mais les essais
peuvent s'avérer très coûteux (essais en vol, essais avec
matériaux rares, instrumentations très chères...) et ils peuvent
être très dangereux (essais nucléaires, environnement
spatial...). Enfin, il peut être difficile de mesurer tous les
paramètres : échelles du problème trop petites (chimie du
vivant, couche limite en fluide...) ou trop grandes 2
(astrophysique, météorologie, géophysique...).
2. La solution analytique, On peut aussi construire un modèle
mathématique permettant la représentation du phénomène
physique. Ces modèles utilisent très souvent des systèmes
d'équations aux dérivées partielles (EDP) ou des systèmes
d'équations différentielles (EDO) non-linéaires dont on ne
connait pas de solutions analytiques en général.
3. La solution numérique (simulation numérique), Il faut alors
résoudre le problème numériquement en transformant les
équations continues de la physique en un problème discret sur
un certain domaine de calcul (le maillage).
Dans certains cas il s'agit de la seule alternative (nucléaire,
astrophysique, spatial...). Dans d'autres cas, les simulations
numériques sont menées en parallèle avec des
expérimentations ou encor des solutions analytiques.

3
Les différentes étapes pour la modélisation numérique :
• Recherche d'un modèle mathématique représentant le
phénomène physique. (Mise en équation du phénomène)
• Elaboration d'un maillage du domaine de calcul (discrétisation
spatial du domaine d’étude en un ensemble de petit domaines).
• Discrétisation des équations de la physique (chercher le
schéma numérique adéquat). (transformation des équations
continues en équations discrètes applicables sur le maillage)
• Etablir les conditions aux limites sur les différentes frontières du
domaine de calcul, ainsi que les conditions initiales.
• Développement et programmation d’un code de calcul des
relations discrètes. (solution d'un problème matriciel).
• Validation du code de calcul (simulation numérique), résolution
des équations discrètes (souvent systèmes linéaires à
résoudre).
• Exploitation, comparaison et interprétation des résultats 4
obtenus.
Pour passer d'un problème exact continu régit par une EDP au
problème approché discret, il existe trois grandes familles de
méthodes :
1. Les schémas aux différences finis (FDM): consistent à
remplacer les dérivées partielles par des différences divisées
ou combinaisons de valeurs ponctuelles de la fonction en un
nombre fini de points discrets ou nœuds du maillage.
• Avantages : grande simplicité d'écriture et faible coût de calcul.
• Inconvénients : limitation à des géométries simples, difficultés
de prise en compte des conditions aux limites de type
Neumann.
2. Les schémas aux éléments finis (FEM): consistent à chercher
une solution approchée dans un sous-espace de dimension
finie, en écrivant notre équation sous forme variationnelle. La
résolution se déroule en deux étapes :
- La formulation faible.
5
- La formulation forte.
• Avantages : traitement possible de géométries complexes,
nombreux résultats théoriques sur la convergence.
• Inconvénient : complexité de mise en œuvre et grand coût en
temps de calcul et mémoire.
3. Les schémas aux volumes finis (FVM) : intègrent sur des
volumes élémentaires de forme simple, les équations écrites
sous forme de loi de conservation. La méthode fournit ainsi de
manière naturelle des approximations discrètes conservatives
et est particulièrement bien adaptée aux équations de la
mécanique des fluides. Sa mise en œuvre est simple avec des
volumes élémentaires de forme géométrique complexes.
• Avantages : permet de traiter des géométries complexes avec
des volumes de forme quelconque, détermination plus
naturelle des conditions aux limites de type Neumann.
• Inconvénient : peu de résultats théoriques de convergence.

6
Equations aux dérivées partielles
Equations différentielles
Impossibilité de trouver directement des solutions analytiques

Utilisation des méthodes numériques approchées :


- Méthode des différences finies
- Méthode des éléments finis
- Méthode des volumes finis

Système d’équations algébriques Facile à résoudre


7
Exemple d’équations différentielles :
Equation différentielle ordinaire d’ordre n est une équation qui
relie une fonction y et ses dérivées :

F x, y, y',........,y n
0
Equation différentielle linéaire si la fonction et ses
dérivées interviennent sans être élevées à une certaine
puissance et si elles ne sont pas multipliées entre elles :
a 0  x  y+a1  x  y' +a 2  x  y''  .........  a n  x  y  g x 
n

Equation différentielle linéaire homogène Ou sans second


membre :
a 0  x  y+a1  x  y' +a 2  x  y''  .........  a n  x  y   0
n

Equation différentielle non linéaire si la fonction et ses


dérivées interviennent avec une puissance ou si elles sont
 
multipliées entre elles : y''  sin y  0 8
Exemple d’équations aux dérivées partielles :
1. Equations de Navier-Stokes :
U
 t d    S Fc .dS   S Fd .dS  0
2. Equations de Maxwell :
 B
  E = -
t

  B =  j +   E
 0 0 0
t
3. Corde vibrante :
2 y 2 y 2 y 1 2 y
 2 =T 2  = 2 2 9
t x t 2
a x
Plan
 Chapitre 1 : Techniques de discrétisation
 Chapitre 2 : Analyse des schémas numérique
(Consistance-Stabilité-Convergence)
 Chapitre 3 : Application :
Résolution de l’équation de la chaleur

10
Techniques de discrétisation
Méthode des différences finies
I- Base de la méthode :
Soit une fonction U(x, y, z, t).

Par définition : U U  x+x, y.... -U  x, y....


= lim
x x 0 x
l’idée de base est de prendre Δx petit mais non nul, et d’éstimer
U par le rapport U  x+x, y.... -U  x, y.... (c’est une approximation)
x x
faisons un développement limité (Taylor) de U(x) au voisinage de x
f h 2  2f h n nf
f  x+h   f  x   h   .................... 
x 2! x 2
n ! x n
 -1 h n  n f
n
f h 2  2f
f  x-h   f  x  -h   ....................  11
x 2! x 2
n! x n
Donc :
U Δx 2  2 U Δx n  n U
U  x+Δx  =U  x  +Δx   ........... 
x 2! x 2
n! x n
U  x+Δx  -U  x  U Δx  2 U Δx n-1  n U
    .........
Δx x 2! x 2
n! x n
T
εT est appelée Erreur de troncature.
Ici εT est proportionnelle à Δx. On dit que εT est du premier ordre
avec : lim  T = 0
x  0

U U  x+x   U  x 
On écrit :   0  x 
x x
x  2 U
T 
2! x 2 12
C’est un schéma numérique
II- Discrétisation de l’espace :
Soit l’espace de dim 1 (l’axe OX).
Soit une fonction U(x) définie sur l’intervalle [0, L]

On divise OL en N segment de largeur Δx : OL = N.Δx


Soit les points : xi = i Δx , i = 0, ………N
Pour simplifier on va appeler les points xi directement : 0, 1,…N

Soit Ui la valeur de U au point xi


Ui = U(xi )= U(i Δx)
Les segments [i, i+1] sont appelés mailles ou cellules du domaine.
Δx : le pas du maillage, les points i sont appelés des nœuds.
Prob: Estimation de U au point xi : U  ?
x  
 x i

 U Δx 2
  2
U  Δx 3
  3
U
Ui+1 = Ui +Δx     2  3  .........................  a 
 x i 2!  x i 3!  x i
 U  Δx   U  Δx   U 
2 2 3 3
Ui-1 = Ui -Δx     2   3  ...........................  b 
 x i 2!  x i 3!  x i
 U  Δx  U 
 33
 a    b   Ui+1 - Ui-1 = 2x    2  3   ..................  c 
 x i 3!  x i
Ui+1 - Ui  U  x   2 U 
a   =  +  2
x 
 i
x 2!  x i erreur de troncature d'ordre 1
εT
 U  Ui+1  Ui x   2 U 
    0  x  avec T   2
 x i x 2!  x i
On l’appelle : schéma décentré en avant. ‘’Forward scheme ‘’

 U  U1  U0  U  U N+1  U N
   ,     conditions aux limites
 x 0 x  x N x

Ui - Ui-1  U  x  U 
 2
b  =  -  2
x  x i 2!  x i erreur de troncature d'ordre 1
εT
 U  Ui  Ui-1 x   2 U 
    0  x  avec T   2 
 x i x 2!  x i

On l’appelle : schéma décentré en arrière. ‘’Backward scheme ‘’


Ui+1 - Ui-1  U  x  U 
 3 2
c  =  +  3
2x  x i 3!  x i erreur de troncature d'ordre 2
εT
 U  Ui+1  Ui-1 x 2  3 U 
 
 x i

x
 0  x 2
 avec T   3
3!  x i
On l’appelle : schéma centré. ‘’Centred scheme ‘’.

Remarque :
Un schéma centré est plus précis qu’un schéma décentré.
T décroit vers zéro plus vite pour un schéma centré.
Les trois schémas utilisent seulement deux points :
Les deux schémas décentrés : (i+1, i) ou (i, i-1).
Le schéma centré : (i+1, i-1).
Interprétation graphique
III- Schémas avec un nombre arbitraire de points :
 U 
Estimons   en fonction de U i , U i-1 , U i-2 par exemple.
 x i
 U  aU i +bU i-1 +cU i-2
   - T 1
 x i x
a, b et c ? T ?
 U  Δx   U  Δx   U 
2 2 3 3
U i-1 = U i -Δx     2   3   ..............
 x i 2!  x i 3!  x i
 U  Δx 2
  2
U  Δx 3
  3
U
U i-2 = U i -2Δx   4  2  8  3   .......
 x i 2!  x i 3!  x i
aU i +bU i-1 +cU i-2 a+b+c  U 
  U i   b+2c    
x Δx  x 
x   2 U  x 2  3U 
 b+4c   2    b+8c   3   ...
2!  x i 3!  x i
 3
 a=
 a+b+c=0 2
 
Pour avoir 1 , il faut que : -  b+2c   1  b  2
 b+4c=0 
  c=
1
 2
x 2
 U
3
2 2 U3
 T    b+8c   3    x  3   ordre 2
3!  x i 3!  x i
 U  3U i -4U i-1 +U i-2
 
 x i

2x
+ 0  x 2

C'est un schéma décentré en arrière d'ordre 2.
 U 
* De même, Estimons   en fonction de U i , U i+1 , U i+2 :
 x i
 U  aU i +bU i+1 +cU i+2
   - T 2
 x i x
a, b et c ? T ?
 U  Δx   U  Δx   U 
2 2 3 3
U i+1 = U i +Δx     2   3   ..............
 x i 2!  x i 3!  x i
 U 
2

Δx  U 2
 Δx  U 
3
 3
U i+2 = U i +2Δx   4  2  8  3   .......
 x i 2!  x i 3!  x i
aU i +bU i+1 +cU i+2 a+b+c  U 
  U i   b+2c    
x Δx  x i 20
x   2 U  x 2  3U 
 b+4c   2    b+8c   3   ...
2!  x i 3!  x i
 3
 a=-
 a+b+c=0 2
 
Pour avoir  2  , il faut que :  b+2c   1   b  2
 b+4c=0  1
 c=-
 2
x 2  3U  2 2  3U 
 T   b+8c   3    x  3   ordre 2
3!  x i 3!  x i
 U  -3U i +4U i+1 -U i+2
 
 x i

2x
+ 0  x 2

C'est un schéma décentré en avant d'ordre de précision 2.
En général pour les schémas décentré, afin d'obtenir un ordre
de précision p il faut utiliser  p+1 points.
IV- Dérivées supérieures :
 2U 
Pb : Estimation de  2  ?
 x i
On peut choisir, par exemple un schéma décentré en arrière pour
 U   U  Ui -Ui-1
l'estimation de   :    + 0  Δx 
 x i  x i x
 U   U 
  - 
  U    U   x i  x i-1
2 2
l'estimation de  2  :  2   + 0  Δx 
 x i  x i x
  2 U  U i -2U i-1  U i-2
  2  + 0  Δx 
 x i x 2

C'est un schéma décentré en arrière d'ordre de précision 1.


On peut choisir, par exemple un schéma décentré en avant pour
 U   U  U i+1 -U i
l'estimation de   :    + 0  Δx 
 x i  x i x
 U   U 
  - 
  U    U   x i+1  x i
2 2
l'estimation de  2  :  2   + 0  Δx 
 x i  x i x
  2 U  U i+2 -2U i+1  U i
  2  + 0  Δx 
 x i x 2

C'est un schéma décentré en avant d'ordre de précision 1.


24
On peut aussi obtenir un schéma centré en utilisant les trois
points : i-1, i, i+1.
  U  aU i-1 +bU i  cU i+1
2

 2  - T  a, b et c ?  T ? 
 x i x 2

 U  Δx 2
  2
U  Δx 3
  3
U
U i+1 = U i +Δx     2   3  ................
 x i 2!  x i 3!  x i
 U  Δx 2
  2
U  Δx 3
  3
U
U i-1 = U i -Δx     2   3  ..................
 x i 2!  x i 3!  x i
aU i-1 +bU i  cU i+1 a+b+c c-a  U  1   U
2
 Ui      c+a   2 
x 2 Δx 2
Δx  x i 2!  x i
25
Δx   3 U  Δx 2  4U 
 c-a   3    c+a   4   .............
3!  x i 4!  x i
 a+b+c=0
1 a=c=1 Δx 2   4 U 

il faut que :   c+a   1    T = 2 4 
2  b=-2 4!  x i
 c-a=0
  2 U  U i-1 -2U i  U i+1
 2   +0  Δx 
2

 x i x 2


 Δx   U 
2 4

  =  4
12  x i
T

C'est un schéma centré d'ordre de précision 2.
Exercices :
Soient les schémas :
 U  aUi-2 +bUi-1  cUi  dUi+1
   - T
 x i x
 U  aUi+2 +bU i+1  cU i  dU i-1  eU i-2
   - T
 x i x
 U 
Estimer   pour chaque schémas en calculant les
 x i
coéfficients a, b, c, d et e ainsi que l'erreur de troncature  T .
Remarque :
Tous les schémas numériques qu’on a établi donne l’estimation de
 U     U   directement en fonction des valeurs de U en
2

   ou  2
 x i   x i 
 U 
différents points ……i-1, i; i+1,……    f ....,Ui-1 , Ui , Ui+1......
x i
On les appelle : Schémas explicites.
V- Formulation des schémas implicites :
Ce sont des schémas où les
U en différents points du maillage
apparaissent simultanément. x
  U   U   U  
f .......,   ,  ,   ,............  g ....,U i-1, U i , U i+1......
  x i-1  x i  x i+1 
Exemples :
1. Schémas implicite décentré en avant :
28
 U  Δx 2
  2
U  Δx 3
  3
U
U i+1 = U i +Δx     2   3  ................
 x i 2!  x i 3!  x i
 U  U - U Δx   2
U  Δx 2
  3
U
  
i+1 i
  2   3  ......
 x i Δx 2!  x i 3!  x i
 U  Δx   U   U  Δx    U   U i+1 - U i
2
    2       
 x i 2!  x i  x i 2! x   x i  Δx
 U   U 
    U -U
 U  Δx  x i+1  x i
    i+1 i

  x i 2! Δx Δx
1  U   U   U i+1 - U i
     
2  x i+1  x i 

Δx
 0  Δx 2

29
Δx 2   3 U 
Avec :  T =  3  schéma implicite décentré en avant d'ordre 2
3!  x i
Rappelons que le schéma explicite décentré en avant est d'ordre 1.
Un schéma implicite est plus précis qu'un schéma explicite utilisant
le même nombre de points.

U
i = 0 et i = N  conditions aux limites U et y sont donnés.
x
 U   U  2
i=1 :        U 2  U1 
 x 1  x 2 x
.
30
.
 U   U  2
i-1 :       Ui  Ui-1 
 x i-1  x i x
 U   U  2
i :      Ui+1  Ui 
 x i  x i+1 x
 U   U  2
i=N-1 :       U N  U N-1 
 x  N-1  x  N x

31
Matrice bidiagonale, il faut inverser la matrice pour calculer les
inconnues :  U   U   U 
  , ..........   , ........   32
 x   x   x 
2. Schémas implicite décentré en arrière :
 U  Δx 2
  2
U  Δx 3
  3
U
U i-1 = U i -Δx     2   3  ................
 x i 2!  x i 3!  x i
 U  U - U Δx   2
U  Δx 2
  3
U
  
i i-1
  2   3  ......
 x i Δx 2!  x i 3!  x i
 U  Δx   2
U   U  Δx    U   U i - U i-1
    2       
 x i 2!  x i  x i 2! x   x i  Δx
 U   U 
   
 U  Δx  x i  x i-1 U i - U i-1
   
 x i 2! Δx Δx
1  U   U   U i - U i-1
  
   
2  x i  x i-1 

Δx
 0  Δx 2
 33
Δx 2   3 U 
Avec :  T =  3  schéma implicite décentré en avant d'ordre 2
3!  x i
Rappelons que le schéma explicite décentré en avant est d'ordre 1.
Un schéma implicite est plus précis qu'un schéma explicite utilisant
le même nombre de points.

U
i = 0 et i = N  conditions aux limites U et y sont donnés.
x
 U   U  2
i=1 :        U1  U 0 
 x 1  x 0 x
.
34
.
 U   U  2
i-1 :       U i-1  U i-2 
 x i-1  x i-2 x
 U   U  2
i :      U i  U i-1 
 x i  x i-1 x
 U   U  2
i=N-1 :       U N-1  U N-2 
 x  N-1  x  N-2 x

35
  U  
  x  
  1    U  
1 0 0 0 0 0 0 0    U1  U 0    x  
1      0 
 1 0 0 0 0 0 0    
0 1 1 0 0 0 0 0    U    
    
0 0 1 1 0 0 0 0    x i 1  2  
  U  U 
0 0    U   x  
i-1 i-2
0 0 1 1 0 0
      Ui  Ui-1 
0 0 0 0 1 1 0 0    x i   
0 0 0 0 0 1 1 0    
    
0 0 0 0 0 0 1 1     U U 
   
 U  
N-1 N-2

 x  N-1  36
Matrice bidiagonale, il faut inverser la matrice pour calculer les
inconnues :  U   U   U 
  , ..........   , ........  
 x 1  x i  x  N-1
3. Schémas implicite centré :
De la même manière on peut définir le schéma implicite centré.

VI- Différence finies dans un espace


multidimensionnelle :
Dim 2 :
Soit U(x, y) tel que : x ε [0, Lx] et y ε [0, Ly].
 On divise [0, Lx] en N segments de largeur Δx :
Lx = N. Δx avec : xi = i. Δx et i = 0, 1, 2……..N
 On divise [0, Ly] en M segments de largeur Δy :
Ly = M. Δy avec : yj = j. Δx et j = 0, 1, 2……..M

Soit le point  x i , y j  noté  i, j tel que U  x i , y j  = Ui,j 37


 
  U Δx 2
  2
U  Δx 3
  3
U
 Ui+1,j = Ui,j +Δx     2   3  ................
  x i,j 2!  x i,j 3!  x i,j
Avec : 
 U = U +Δy  U  Δy 2
  2
U  Δy 3
  3
U
         ................
  
i,j+1 i,j 2 3 38
  i,j
y 2!  y i,j 3!  y i,j
Exemples :
 U   U 
1) Schémas décentrés en avant pour :  et  
 x i,j  y i,j
 U  U i+1,j  U i,j x   U 2

    0  x  avec T   2 
 x i,j x 2!  x i

 U   U i,j+1  U i,j  0  y  avec T 
y   2 U 
 y   2 
 i,j
 y 2!  y i
 2U   2U 
2) Schémas centrés pour :  2  et  2 
 x i,j  y i,j
 U
2
U  2U  U x   U 
2 2

 2    0  x  avec T    2 
i+1,j i,j i-1,j 2

 x i,j x 12  x i,j
2

 2
  U   Ui,j+1  2Ui,j  Ui,j-1  0 y 2 avec y 2   2 U 
 y 2  y
   T    392 
12  y i,j
 i,j
3. Discrétisation du Laplacien :
2U 2U
U = +
x 2
y 2
U2
U 2
Choisissons des schémas centrés d'ordre 2 pour et
x 2
y 2

U i+1,j  2U i,j  U i-1,j U i,j+1  2U i,j  U i,j-1


U =   T
x 2
y 2

x 2   4 U  y 2   4 U 
T   4   4
12  x i,j 12  y i,j
Si x = y
U i+1,j  U i,j+1  4U i,j  U i-1,j  U i,j-1
U =  T 40

x 2
Autre schéma de discrétisation du Laplacien :

Ui+1,j+1  Ui+1,j-1  4Ui,j  Ui-1,j+1  Ui-1,j-1


U =  0  x 2 
x 2

41
  U 
2

4. Discrétisation des dérivées croisées :  


 xy i,j
 2U    U 
    
 xy i,j x  y i,j
Suivant les choix des schémas de discrétisation
ère  U
2
des dérivées 1 on aura des schémas pour   .
 xy i,j

42
VII- Maillage irrégulier :

x i  x i  x i-1
 U  Δx 2
  2
U  Δx 3
  3
U
   2   3  ................
i+1 i+1
U i+1 = U i +Δx i+1 
 x i 2!  x i 3!  x i
 U  Δx i   U  Δx i   U 
2 2 3 3
U i-1 = U i -Δx i     2   3  ..................
 x i 2!  x i 3!  x i
 U  U i+1  U i
 Schéma décentré en avant :     0  x i+1 
 x i x i+1
 U  U i  U i-1
 Schéma décentré en arrière :     0  x i 
 x i x i 43
VII- Discrétisation dans le temps :
U U
Soit l'équation a  0 avec
t x
a=c te  équation de BURGERS  , U  x, t  ?
Domaine de calcul :

De la même façon on divise l’axe du temps en un certains


nombres d’intervalles de largeur Δt.

Soit les instants : t n  n.t, U  x i , t n  = U  i.x, n.t  = U n


i

 U   U 
n n

au point i.x à l'instant n.t :   = - a 


 
44
 t i  x i
 U 
n

Pour le terme spacial   , on peut choisir :


 x i
- Un schéma décentré en arrière d'ordre 1 :
 
n
 
n n
U U U
  = i i-1
 0  x  1
 x i x
 U  U  U
n n n
- Un schéma centré d'ordre 2 :   =  0  x 
i+1 2 i-1
 2
 x i 2x
- Ou autres schémas.
 U 
n

Pour le terme temporel   ,


 t i
Faisons un développement limité de U  x i , t n   Uin par rapport45à t :
U
U  x i , t n+1  =U  ix,  n+1 t  =U  ix, nt   t xi, t n 
t
n
t 2
 U
2
+  2   .......
2!  t i
n n
 U  Δt   U  Δt   U 
n 2 2 3 3
 U = U +Δt     2    3  ....
n+1 n

 t i 2!  t i 3!  t i
i i

n
 U  U - U Δt   U 
n n+1 n 2
      2 
i i
Schéma d'Euler 
 t i Δt 2!  t i
0 t  d'ordre 1 pour t

U -U n+1
U U
n n n
Alors : 1   a
i i
 0  t, x  i i-1

Δt x 46
n+1 n
U U n n
 
2 
U i

Δt
-U

i
 a i+1

2x

i-1
0   t,  x 2

Δt
Posons :  = a
Δx
1  U in+1  U in    U in  U i-1
n
   U n
 1    i
U n


i-1

 


 2   U n+1
i  U n
i 
2
 U n
i+1  U i-1 
n
 0   t,  x 2

1  U1n+1   U 0n  1    U1n
U n+1
2   U1
n
 1    2
U n

.
.
47
U in+1   U i-1n  1    U in
.
U n+1   N-2 
    N-1
n n
N-1 U 1 U
 U1n+1  1-   U1n    U 0n 
      
   .    0 
   .    0 
 n+1    n   
 Ui-1    1      Ui-1    0 
  n+1  
Ui   1      Un   0 
    i   
   .    0 
   .    0 
      
 U n+1    1      U nN-1   0 
 N-1   48
matrice bidiagonale
On part des conditions initiales Ui0 et on calcule
1 2 n n+1
ensuite directement U , U , ......U , U
i i i i

Ce schéma est appelé : schéma explicite d'Euler d'ordre 1.



 2  U n+1
i U 
n
i
2
 i+1 i-1 
U n
 U n


U n+1
1 U 
n
1
2
 2 0
U n
 U n


U n+1
2 U 
n
2
2
 U n
3 U n
1 
.
.
49

U in+1  U in 
2
 U n
i+1  U i-1
n

.

U n+1
N-1  U N-1 
n

2
 U n
N  U nN-2 

  
1  
2   n 
 U1n+1     Un   U0 
  
.  1   2 
   .    0 
    
   0 
 n+1   1 
   
 U i-1   2 2   U i-1  
n
0 
  n+1     n    
 
   i  
Ui U 0
 1  
   2 2    0 
   .    
   0
   
 U n+1   .  U   
n 
 N-1     N-1 
  UN 
n

   2 
1 
 2  50
matrice tridiagonale
 C'est le schéma explicite d'Euler centré d'ordre 1
en temps et d'ordre 2 en espace.
Remarque :
Si on prend une discrétisation décentré en arrière pour le temps :
n n
 U  Δt   U  Δt   U 
n 2 2 3 3

   2    3  ....
n-1 n
U = U -Δt 
 t i 2!  t i 3!  t i
i i

 U  U U
n n n-1
  
i i
 0  Δt 
 t i Δt
U Un n-1
U U n n
1  i i
 a i
 0  Δt,Δx 
i-1

Δt Δx
cad : U in  U in-1    U in  U i-1 
n 51
 1    Uin   Ui-1n+1  Uin
 U1n  1+ 
 U1  n+1

    
   .  
   .  
 n     n+1 
 Ui-1    1      Ui-1 
 n    U n+1 

Ui
 
 1     
 i

   .  
   .  
    
 Un    1      U n+1 
 N-1   N-1 
matrice bidiagonale
n+1 52
Pour calculer U il faut inverser la matrice. C'est un schéma imlicite.
Analyse des schémas numérique
(Consistance-Stabilité-Convergence)
Partons de l’exemple :
 U U
 +a =0
 t x
a = C te , x   0, L  et t  0

n n
 U  Δt   U  Δt   U 
n 2 2 3 3

   2    3  ....
n+1 n
U = U +Δt 
 t i 2!  t i 3!  t i
i i

n
U  U  Δt   U 
n+1 n n 2
U
 i
 i
   2  1
Δt  t i 2!  t i
n n
 U  Δx   U  Δx   U 
n 2 2 3 3

  
n n
U = U +Δx   2   3 
....
 x i 2!  x i 3!  x i
i+1 i 53
n n
 U  Δx   U  Δx   U 
n 2 2 3 3

   2   3  ....
n n
U = U -Δx 
 x i 2!  x i 3!  x i
i-1 i

n
U  U  Δx   U 
n n n 2 3
U
 i+1 i-1
    3  2
2Δx  x i 3!  t i
U U U  U U 
n+1 n n n n
U
1 et  2   i
a i i+1 i-1
 +a    T  3
Δt 2Δx  t x i
0
n n
Δt   U  Δx   U 
2 2 3
T   2    3  erreur de troncature
2!  t i 3!  t i
 3 est le schéma explicite d'Euler  temps  centré dans
l'espace, d'odre 1 dans le temps et d'ordre 2 dans l'espace.54
En résumé :
 U   U 
n n

  +a   0 Problème exact
 t i  x i

discrétisation

U in+1  U in n
U i+1  U i-1
n
a  T Problème discrétisé
Δt 2Δx
n n
Δt   U  2
Δx   U  2 3
Avec :  T   2 
    Pr approché 
2!  t i 3!  t 3 i

Schéma numérique (on néglige εT)

U in+1  U in U in+1  U i-1


n
a  0 55
Δt 2Δx
Soit :
U in : solution exacte du problème exact :
 solution analytique  .
U in : solution exacte du problème discrétisé.
U in : solution numérique.
Problèmatiaue :
chercher la solution approchée du problème approché.

56
• Consistance du schéma :
c'est la propriété qui assure que la solution exacte des
équations discrétisées tende vers la solution exacte des
équations continues lorsque le pas de discrétisation (∆t et ∆x)
tendent vers zéro.
Problème exact Problème approché
le schéma est dit consistant si :
lim  T  0
t  0
x 0
n n
Δt   U 2
Δx   U 2 3
Ici dans notre pb  T   2 
  3 
2!  t i 3!  t i
et donc quand les pas du maillage Δt et Δx  0
 T  0  notre schéma est consistant.
57
• Stabilité du schéma :
C'est la propriété qui assure que la différence entre la solution
numérique obtenue et la solution exacte des équations
discrétisées est bornée.
Problème approché Schéma numérique

Solution Uin Solution Uin


Soit l'erreur commise au point i à l'instant t :
 in = Uin  Uin
le schéma est dit consistant si cette erreur  n’augmente pas
n
i
indéfiniment au cours du temps.
Comment le vérifier ? (voir par la suite l’analyse de VON-
NEUMANN).
58
• Théorème de LAX :
Un schéma consistant et stable est convergent.

59
• Etude de la stabilité : Analyse de VON-NEUMANN
Soit l'erreur commise au point i à l'instant t :
 in = U in  U in
U in Solution exacte du Pb discrétisé, U in Solution numérique.
U in+1  U in n
U i+1  U i-1
n
Or : a 0
Δt 2Δx
 in+1   in  i+1
n
  i-1
n
U in+1  U in n
U i+1  U i-1
n
 a  a 0
Δt 2Δx Δt 2Δx
T


 n+1
 n n n
Si on néglige  T : i
a i i+1 i-1
0
Δt 2Δx
 i vérifie la même relation que U i .
n n
60
Supposons que la distribution de l’erreur à l’étape n est la
suivante:

Comme les conditions de bord sont périodiques, on va prolonger


cette erreur sur [-L, 0] et on la considère comme périodique.

Décomposition d’une fonction périodique en série de Fourier


Toute fonction périodique sur [-L, L] peut être approchée par une
somme de plusieurs fonctions sinusoïdales (harmoniques).

I  1
N
 =
i
n
E e
j=-N
n Ik j xi
j
2
61
n
E : amplitude de l'harmonique j à l'étape n
j

2
k j : nombre d'onde de l'harmonique j  pulsation  j =
kj

62
Soit j une harmonique intermédiaire :
 
k j  jk min  j j
L Nx
N N N 
ix
E e E e E e
Ij
n Ik jix
 =
i
n n Ik j x i
j  j  n
j
Nx

j=-N j=-N j=-N

N  
Ii  j. 
 E e
j=-N
n
j
 N


On pose  j  j.
N
 déphasage : -  j   
N
  = i
n
E e
j=-N
n I.i. j
j 63
n I.i. j
Soit une harmonique j tel que : E e j  E n eI.i.
Soit notre schéma numérique :
 in+1   in  i+1
n
  i-1n U in+1  U in n
U i+1  U i-1
n
a  0 ou a 0
Δt 2Δx Δt 2Δx
n I.i.
Injectons l'harmonique E e dans le schéma numérique :
n+1 I.i. n I.i. n I. i+1. n I. i-1.
E e E e Ee E e
a 0
Δt 2Δx
t
Posons :   a  nombre de courant  et simplifiont par e I.i.

x
I -I

n e e 
Donc : E  E   E 
n+1 n
 0
 2  64
Isin
 E n+1  E n   E n Isin  0
E n+1
 n
 1   Isin
E
• Définition :
E n+1
On appelle Facteur d’amplification G = n
E
Pour que le schéma soit stable il faut que : G  1
Dans notre cas : G = 1+ 2 sin 2   1  
2

Donc le schéma explicite d’Euler centré dans l’espace est


instable.
• Prenons le schéma explicite d’Euler
décentré en avant dans l’espace :
Uin+1 - Uin Uin  Ui-1
n
+a =0
Δt x 65
n n
t   U 
2
x   U  2
avec :  T   2  a  2 
2  t i 2  x i
lim  T  0  le schéma est consistant.
t  0
x  0

t
U n+1
 U  U  U
n n n
  =a
x
i i i i-1

U in+1  1    U in   U i-1
n
 
Soit une harmonique E n e I.i.
 
  E n+1 I.i.
e  1    E n I.i.
e   E n
e
I. i-1.

E n+1
 n
 G= 1      e -I
 1       cos   Isin 
E
= 1     cos   - I sin
 G= +I
66
  1     cos    1      cos 
 
    sin     sin
  1     + =  cos   +   sin  = 2
2 2 2 2

C'est l'équation d'un cercle centré en 1- , 0  de rayon  .


t
Si   a  0  a  0  G  1  schéma instable.
x
Si   1  1-  0  G  1  schéma instable.
Si 0    1  0  1-  1  G  1  schéma stable.

67
• Le schéma implicite d’Euler centré :
U in+1 - U in n+1
U i+1  U i-1
n+1
+a = 0  
Δt 2x
n I.i.
Etude de la stabilité : Soit une harmonique E e
n+1 I.i. I.i. n+1 I. i+1. n+1 I. i-1.
E e -E e n
E e E e
   +a =0
Δt 2x
E n+1 - E n I.i. a n+1 I.i.
 e + E e  e I  e-I  = 0
Δt 2x
2Isin

E n+1 E n+1
 n  1  n  Isin  0
E E
E n+1 E n+1 1
 n 1   Isin   1  G = 
E E n
1   Isin
68 
1
G   1 
2

1   sin 
2 2

Le schéma est stable sans conditions.

69
• Application des Schémas centrés :
1.Euler centré :

 U U
 +a =0
 t x
 U  x, t=0   U 0  x 

U in+1 - U in n
U i+1  U i-1
n
 +a =0
Δt 2x

U n+1
i U 
n
i
2
 i+1 i-1 
U n
 U n
1
n n
t   U  x   U 
2 2 3
Avec :  T   2    3
2  t i 3!  x i
70
n I.i.
Etude de la stabilité : Soit une harmonique U  E e n
i

Ene    Ene  
I. i+1 . I. i-1 .
E n+1e I.i. - E n e I.i.
1  +a =0
Δt 2x
n+1 n
E - E I.i. a
 e + E n e I.i. e I  e-I  = 0
Δt 2x
2Isin

E n+1
 G = n  1   Isin
E
 G  G.G = 1   2sin 2  1   schéma instable
2

71
2. Schéma de LAX FRIEDERICKS :
C’est un schéma qui est introduit pour stabiliser le schéma
centré d’Euler. On remplace dans (1)

U par  U i+1  U i-1 


n 1 n n
i
2
 n
 U i   U i+1  U i-1    U i+1  U i-1 
1 n
n+1 n n
2
2 2
Etude de la stabilité : Soit une harmonique U in  E n e I.i.
n I. i+1. n I. i-1.
E e
 2  E e = E e  e  e  - 
1 n I.i. I
n+1 I.i. -I E e
2 2
E e e  e 
n I.i. I. -I.

 E e = E e e  e  - 
n+1 I.i. 1 n I.i. I -I
72
2 2
E n+1
 G = n  cos    .I.sin
E
 G  G.G = cos 2   2sin 2
2

t
On voit que le schéma est stable si   1 a  1.
x
 même condition que le schéma upwind 
Erreur de troncature :
U U  U U 
n
1  n+1 1 n n 
n n

 Ui   Ui+1  U i-1   + a i+1 i-1


= a   T
Δt  2  2x  t x i
n
 U  Δt   U 
n 2 2

   2   ....
n+1 n
U = U +Δt 
 t i 2!  t i
i i

73
n n
 U  Δx   U  Δx   U 
n 2 2 3 3
U = U  Δx 
n
i 1
n
   2   3  ....
 x i 2!  x i 3!  x i
i

1 Δx   U 
2 n

  U i+1  U i-1   U i 
n n n
 2   ...
2 2!  x i



 1 U n -U n  Δx  U 
n

 2  i+1 i-1  
 

i
 x
n n
 U  Δt   U  Δx   U 
n 2 2 2 2
  U i+1  U i-1   Δt 
1 n
U n+1 n
   2    2
 t i 2  t i 2!  x i
i
2
n n
Δt   U  Δx   U 
2 2 2
 T   2    
2  t i 2Δt  x 2 i
Δx a 74
2 
 Ordre 1 en temps et ordre 2 en espace.
U U 2U  2
U
Or : = -a  a 2

t x t 2
x 2
n
aΔx   1   U 
2 2
 T   2 
2   x i
Comparaison des schémas upwind et Lax
Friedricks : n
x  U
2
 T upwind  a   1  2 
2  x i
 T upwind   1  
  1
 T LF   1  1 1   
Le schéma upwind est meilleur que le schéma de 75L.F.
3. Schéma de Lax Wendroff :
C’est un schéma centré du 2ème ordre dans l’espace. Il est
obtenu en faisant un développement de Taylor suivant le
temps jusqu’à l’ordre 3.
n
 U  Δt   U 
n 2 2
U n+1
i
n
= U +Δt 
i 
 t i
  2 
2!  t i
 0  Δt 3

U U 2U 2  2
U
et on remplace par -a et par a
t x t 2
x 2

n
 U  2 Δt   U 
n 2 2
 U = U -aΔt   a
n+1 n
 2 
 x i 2!  x i
i i

Et pour les discrétisations spatiale, on utilise des


schémas centrés:
76
 U n U i+1
n
 Ui-1
n

  
 x i 2Δx
 2 n

 U  Ui+1  2U i  U i-1
n n n

 x 2   Δx 2
 i
Δt a 2
Δt 2
 U i = U i -a
n+1 n

2Δx
 U i+1  U i-1  
n n

2 Δx 2  i+1
U  2U i  U i-1 
n n n

  2
 U in+1 = U in -  U i+1
n
 U i-1
n
   U n
i+1  2U n
i  U i-1   Sch.L.W 
n

2 2

77
Erreur de troncature :
Montrer, à titre d’exercice que :
n n
Δt   U 
2 3
Δx   U  2 3
T   3 
a  
6  t i 6  x 3 i
 Ordre 2 en temps et ordre 2 en espace.
3U 3   3
U
Or : =-a  3 
t 3
 x 
n
Δx 2
 U 3
 T  a 1     x 3 
2

2  i

78
Etude de la stabilité :
Soit une harmonique U in  E n e I.i.
E n+1  I  2
G=
E n
 1 
2
 e  e -I
 +
2
 e I
 2  e -I

2
 G =1   I sin  +  2cos  2 
2
 G = 1   2   2 cos   I sin    + I β

   1    
2
2
β2
  1
  2
  2


 l'extrémité de OG parcourt l'ellipse de centre
β
1   2
, 0  de demi-axes  2
et  . 79
Condition de stabilité : G  1

Il faut donc que :   1 et 1- 2  1


éllipse à l'intérieure du cercle de rayon 1.
t
  1  a 1
x
Même conditions que les autres schémas.
80
Mais il est d'ordre de précision supérieure.
4. Schéma de Leap-Frog : (saut de grenouille)
On utilise un schéma centré dans l’espace et un schéma
centré dans le temps.

 U  U  U  
n n+1 n-1 n n n
U U U
  
i i i+1 i-1
 et  
 t i 2Δt  x i 2Δx
 Uin+1 = Uin-1 -  Ui+1
n
 Ui-1
n

81
Ce schéma utilise trois niveaux n, n-1, n+1.
Donc pour démarrer les calculs il faut obligatoirement avoir
comme données les conditions n = 0 et n = 1.
Dans la pratique : l’étape n = 0 (C.I) et l’étape n = 1 sont obtenues
en utilisant par exemple un des schémas précédents.
On peut montrer que :
n n
Δt   U 
2 3
Δx   U  2 3
 temps 1
T   3  a  3  ordre 
6  t i 6  x i espace 1
Stabilité    1.

82
5. Cas 2D :
U U U
a b 0 a, b  0 U  x, y, t  ?
t x y
Au point  i, j à l'étape n  U n
ij

On cherche pour tout n  cad  t  les quantités U n


ij

avec : 1  i  N-1 et 1  j  M-1


cad  N-1 M-1 inconnus.
Connaissant les conditions initiales  C.I  et les conditions
aux limites  C.L  .
83
y
M

Δy

Δx

0 N x 84

Vous aimerez peut-être aussi