source: trunk/tools/bsf/inversion.pro

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

fill uses paragraph in header with used commons

  • Property svn:keywords set to Id
File size: 1.2 KB
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; @todo
7; missing build_laplacien_t module
8;
9; @uses
10; <pro>common</pro>
11; <propost_it>com_eg</propost_it>
12;
13; @history
14; Creation : printemps 1998 / G. Roullet
15;
16; @version
17; $Id$
18;
19;-
20FUNCTION inversion, b $
21         , GUESS=guess $
22         , F=f $
23         , TOL=tol $
24         , _EXTRA=extra
25;
26  compile_opt idl2, strictarrsubs
27;
28@common
29@com_eg
30;
31COMMON laplaciens, lapla_t, lapla_f
32
33   IF (where(b NE 0))[0] EQ -1 THEN return, fltarr(jpi, jpj)
34
35   IF n_elements(guess) EQ 0 THEN guess = fltarr(jpi, jpj)
36
37   IF keyword_set(tol) EQ 0 THEN tol = 1e-3
38
39   print, '          Solver precision:', tol
40
41   IF n_elements(f) EQ 0 THEN BEGIN
42      IF n_elements(lapla_t) EQ 0 THEN build_laplacien_t   
43      A = lapla_t
44   ENDIF ELSE BEGIN
45      IF n_elements(lapla_f) EQ 0 THEN build_laplacien_f   
46      A = lapla_f
47   ENDELSE
48
49   zb = double(b)
50   zx = double(guess)
51
52   zr = linbcg(A, zb[*], zx[*], tol = tol, iter = iter, /double, _EXTRA=extra)
53   print, '          Number of iterations :', iter
54
55   zr = boundperio(reform(zr, jpi, jpj), ff = f)
56   
57   return, zr
58END
Note: See TracBrowser for help on using the repository browser.