source: trunk/tools/bsf/inversion.pro @ 163

Last change on this file since 163 was 163, checked in by pinsard, 15 years ago

going on modify unformal header to idldoc 2. header syntax

File size: 980 bytes
Line 
1;+
2;
3; Resolution de l'equation A.X=b ou A est une matrice creuse
4; et (x,b) sont des champs horizontaux
5;
6; @history
7; Creation : printemps 1998 / G. Roullet
8;
9; @version
10; $Id$
11;
12;-
13FUNCTION inversion, b, GUESS = x, F = f, TOL = tol, _extra = extra
14@common
15@com_eg
16COMMON laplaciens, lapla_t, lapla_f
17
18   IF (where(b NE 0))[0] EQ -1 THEN return, fltarr(jpi, jpj)
19
20   IF n_elements(x) EQ 0 THEN x = fltarr(jpi, jpj)
21
22   IF keyword_set(tol) EQ 0 THEN tol = 1e-3
23
24   print, '          Solver precision:', tol
25
26   IF n_elements(f) EQ 0 THEN BEGIN
27      IF n_elements(lapla_t) EQ 0 THEN build_laplacien_t   
28      A = lapla_t
29   ENDIF ELSE BEGIN
30      IF n_elements(lapla_f) EQ 0 THEN build_laplacien_f   
31      A = lapla_f
32   ENDELSE
33
34   zb = double(b)
35   zx = double(x)
36
37   zr = linbcg(A, zb(*), zx(*), tol = tol, iter = iter, /double, _extra = extra)
38   print, '          Number of iterations :', iter
39
40   zr = boundperio(reform(zr, jpi, jpj), ff = f)
41   
42   return, zr
43END
Note: See TracBrowser for help on using the repository browser.