source: LMDZ5/branches/LF-private/libf/bibio/arth.F90 @ 5443

Last change on this file since 5443 was 1425, checked in by lguez, 14 years ago

Replaced Numerical Recipes procedures for spline interpolation (not in
the public domain) by procedures from the Pchip package in the Slatec
library. This only affects the program "ce0l", not the program
"gcm". Tested on Brodie SX8 with "-debug" and "-prod", "-parallel
none" and "-parallel mpi". "start.nc" and "limit.nc" are
changed. "startphy.nc" is not changed. The relative change is of order
1e-7 or less. The revision makes the program faster (tested on Brodie
with "-prod -d 144x142x39", CPU time is 38 s, instead of 54
s). Procedures from Slatec are untouched, except for
"i1mach.F". Created procedures "pchfe_95" and "pchsp_95" which are
wrappers for "pchfe" and "pchsp" from Slatec. "pchfe_95" and
"pchsp_95" have a safer and simpler interface.

Replaced "make" by "sxgmake" in "arch-SX8_BRODIE.fcm". Added files for
compilation by FCM with "g95".

In "arch-linux-32bit.fcm", replaced "pgf90" by "pgf95". There was no
difference between "dev" and "debug" so added "-O1" to "dev". Added
debugging options. Removed "-Wl,-Bstatic
-L/usr/lib/gcc-lib/i386-linux/2.95.2", which usually produces an error
at link-time.

Bash is now ubiquitous while KornShell? is not so use Bash instead of
KornShell? in FCM.

Replaced some statements "write(6,*)" by "write(lunout,*)". Replaced
"stop" by "stop 1" in the case where "abort_gcm" is called with "ierr
/= 0". Removed "stop" statements at the end of procedures
"limit_netcdf" and main program "ce0l" (why not let the program end
normally?).

Made some arrays automatic instead of allocatable in "start_inter_3d".

Zeroed "wake_pe", "fm_therm", "entr_therm" and "detr_therm" in
"dyn3dpar/etat0_netcdf.F90". The parallel and sequential results of
"ce0l" are thus identical.

File size: 1.8 KB
Line 
1MODULE arth_m
2
3  IMPLICIT NONE
4
5  INTEGER, PARAMETER, private:: NPAR_ARTH=16, NPAR2_ARTH=8
6
7  INTERFACE arth
8     ! Returns an arithmetic progression, given a first term "first", an
9     ! increment and a number of terms "n".
10
11     MODULE PROCEDURE arth_r, arth_i
12     ! The difference between the procedures is the type of
13     ! arguments "first" and "increment" and of function result.
14  END INTERFACE
15
16  private arth_r, arth_i
17
18CONTAINS
19
20  pure FUNCTION arth_r(first,increment,n)
21
22    REAL, INTENT(IN) :: first,increment
23    INTEGER, INTENT(IN) :: n
24    REAL, DIMENSION(n) :: arth_r
25
26    ! Variables local to the procedure:
27
28    INTEGER :: k,k2
29    REAL :: temp
30
31    !---------------------------------------
32
33    if (n > 0) arth_r(1)=first
34    if (n <= NPAR_ARTH) then
35       do k=2,n
36          arth_r(k)=arth_r(k-1)+increment
37       end do
38    else
39       do k=2,NPAR2_ARTH
40          arth_r(k)=arth_r(k-1)+increment
41       end do
42       temp=increment*NPAR2_ARTH
43       k=NPAR2_ARTH
44       do
45          if (k >= n) exit
46          k2=k+k
47          arth_r(k+1:min(k2,n)) = temp + arth_r(1:min(k,n-k))
48          temp=temp+temp
49          k=k2
50       end do
51    end if
52  END FUNCTION arth_r
53
54  !*************************************
55
56  pure FUNCTION arth_i(first,increment,n)
57
58    INTEGER, INTENT(IN) :: first,increment,n
59    INTEGER, DIMENSION(n) :: arth_i
60    INTEGER :: k,k2,temp
61    if (n > 0) arth_i(1)=first
62    if (n <= NPAR_ARTH) then
63       do k=2,n
64          arth_i(k)=arth_i(k-1)+increment
65       end do
66    else
67       do k=2,NPAR2_ARTH
68          arth_i(k)=arth_i(k-1)+increment
69       end do
70       temp=increment*NPAR2_ARTH
71       k=NPAR2_ARTH
72       do
73          if (k >= n) exit
74          k2=k+k
75          arth_i(k+1:min(k2,n))=temp+arth_i(1:min(k,n-k))
76          temp=temp+temp
77          k=k2
78       end do
79    end if
80  END FUNCTION arth_i
81
82END MODULE arth_m
Note: See TracBrowser for help on using the repository browser.