source: trunk/LMDZ.COMMON/libf/misc/arth_m.F90 @ 3452

Last change on this file since 3452 was 1441, checked in by emillour, 9 years ago

Updates in common dynamics (seq and ) to keep up with updates
in LMDZ5 (up to LMDZ5 trunk, rev 2250):

  • compilation:
  • added test in grid/dimension/makdim to check that # of longitudes is a multiple of 8
  • dyn3d_common:

Bug correction concerning zoom (cf LMDZ5 rev 2218)

  • coefpoly.F becomes coefpoly_m.F90 (in misc)
  • fxhyp.F => fxhyp_m.F90 , fyhyp.F => fyhyp_m.F90
  • new routines for zoom: invert_zoom_x_m.F90 and principal_cshift_m.F90
  • inigeom.F adapted to new zoom definition routines
  • fluxstokenc.F : got rid of calls to initial0()
  • dyn3d:
  • advtrac.F90 : got rid of calls to initial0()
  • conf_gcm.F90 : cosmetic changes and change in default dzoomx,dzoomy values
  • guide_mod.F90 : followed updates from Earth Model
  • gcm.F is now gcm.F90
  • dyn3dpar:
  • advtrac_p.F90, covcont_p.F90, mod_hallo.F90 : cosmetic changes
  • conf_gcm.F90 : cosmetic and changed in default dzoomx,dzoomy values
  • parallel_lmdz.F90 : updates to keep up with Earth model
  • misc:
  • arth.F90 becomes arth_m.F90
  • wxios.F90 updated wrt Earth model changes
  • nrtype.F90 and coefpoly_m.F90 added
  • ran1.F, sort.F, minmax.F, minmax2.F, juldate.F moved over from dyn3d_common

EM

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.