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

Last change on this file since 68 was 2, checked in by post_it, 17 years ago

Initial import from ~/POST_IT/

File size: 955 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;; Creation : printemps 1998 / G. Roullet
7;;
8;-
9FUNCTION inversion, b, GUESS = x, F = f, TOL = tol, _extra = extra
10@common
11@com_eg
12COMMON laplaciens, lapla_t, lapla_f
13
14   IF (where(b NE 0))[0] EQ -1 THEN return, fltarr(jpi, jpj)
15
16   IF n_elements(x) EQ 0 THEN x = fltarr(jpi, jpj)
17
18   IF keyword_set(tol) EQ 0 THEN tol = 1e-3
19
20   print, '          Solver precision:', tol
21
22   IF n_elements(f) EQ 0 THEN BEGIN
23      IF n_elements(lapla_t) EQ 0 THEN build_laplacien_t   
24      A = lapla_t
25   ENDIF ELSE BEGIN
26      IF n_elements(lapla_f) EQ 0 THEN build_laplacien_f   
27      A = lapla_f
28   ENDELSE
29
30   zb = double(b)
31   zx = double(x)
32
33   zr = linbcg(A, zb(*), zx(*), tol = tol, iter = iter, /double, _extra = extra)
34   print, '          Number of iterations :', iter
35
36   zr = boundperio(reform(zr, jpi, jpj), ff = f)
37   
38   return, zr
39END
Note: See TracBrowser for help on using the repository browser.