source: LMDZ6/trunk/libf/phymar/legtri.F90 @ 3863

Last change on this file since 3863 was 2089, checked in by Laurent Fairhead, 10 years ago

Inclusion de la physique de MAR


Integration of MAR physics

File size: 2.2 KB
Line 
1SUBROUTINE LEGTRI (PSIN,KCP,KDIM,PALP)
2
3!**** *LEGTRI* - *LEGENDRE FUNCTIONS FOR A TRIANGULAR TRUNCATION.
4
5!     J.F.GELEYN     E.C.M.W.F.     03/06/82.
6
7!     PURPOSE.
8!     --------
9
10!          THIS ROUTINE COMPUTES THE VALUES *PALP* FOR THE ARGUMENT
11!     *PSIN* OF THE NORMALISED *LEGENDRE ASSOCIATED FUNCTIONS IN THE
12!     ORDER ((JN1=JM1,KCP),JM1=1,KCP) FOR JN=JN1-1 AND JM=JM1-1 .
13
14!**   INTERFACE.
15!     ----------
16
17!          *LEGTRI* IS CALLED FROM *RADMOD*.
18!          THERE ARE THREE DUMMY ARGUMENTS: *PSIN* IS THE SINE OF
19!     LATITUDE.
20!                                           *KCP* IS ONE PLUS THE LIMIT
21!     WAVE NUMBER.
22!                                           *PALP* IS THE ARRAY OF THE
23!     RESULTS.
24
25!     METHOD.
26!     -------
27
28!          SIMPLE RECURENCE FORMULA.
29
30!     EXTERNALS.
31!     ----------
32
33!          NONE.
34
35!     REFERENCE.
36!     ----------
37
38!          NONE.
39
40
41#include "tsmbkind.h"
42
43IMPLICIT NONE
44
45
46!     DUMMY INTEGER SCALARS
47INTEGER_M :: KCP
48INTEGER_M :: KDIM
49
50!     DUMMY REAL SCALARS
51REAL_B :: PSIN
52
53REAL_B :: PALP(KDIM)
54
55!     LOCAL INTEGER SCALARS
56INTEGER_M :: IC, ICP, II, IM, IM2, JM1, JN
57
58!     LOCAL REAL SCALARS
59REAL_B :: Z2M, ZCOS, ZE1, ZE2, ZF1M, ZF2M, ZM, ZN, ZN2, ZRE1, ZSIN
60
61
62!     ------------------------------------------------------------------
63
64!*         1.     PRELIMINARY SETTING.
65!                 ----------- --------
66
67
68ZSIN=PSIN
69ICP=KCP
70
71!     ------------------------------------------------------------------
72
73!*         2.     COMPUTATIONS.
74!                 -------------
75
76
77IC=ICP-1
78ZCOS=SQRT(_ONE_-ZSIN**2)
79II=2
80PALP(1)=_ONE_
81ZF1M=SQRT(3._JPRB)
82PALP(2)=ZF1M*ZSIN
83DO JM1=1,ICP
84  IM=JM1-1
85  ZM=IM
86  Z2M=ZM+ZM
87  ZRE1=SQRT(Z2M+3._JPRB)
88  ZE1=_ONE_/ZRE1
89  IF(IM == 0) GO TO 201
90  ZF2M=ZF1M*ZCOS/SQRT(Z2M)
91  ZF1M=ZF2M*ZRE1
92  II=II+1
93  PALP(II)=ZF2M
94  IF(IM == IC) GO TO 203
95  II=II+1
96  PALP(II)=ZF1M*ZSIN
97  IF(JM1 == IC) GO TO 203
98  201 CONTINUE
99  IM2=IM+2
100  DO JN=IM2,IC
101    ZN=JN
102    ZN2=ZN**2
103    ZE2=SQRT((4._JPRB*ZN2-_ONE_)/(ZN2-ZM**2))
104    II=II+1
105    PALP(II)=ZE2*(ZSIN*PALP(II-1)-ZE1*PALP(II-2))
106    ZE1=_ONE_/ZE2
107  ENDDO
108  203 continue
109ENDDO
110
111!     ------------------------------------------------------------------
112
113!*         3.     RETURN.
114!                 -------
115
116
117RETURN
118END SUBROUTINE LEGTRI
119
120
121
Note: See TracBrowser for help on using the repository browser.