[2089] | 1 | SUBROUTINE 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 | |
---|
| 43 | IMPLICIT NONE |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | ! DUMMY INTEGER SCALARS |
---|
| 47 | INTEGER_M :: KCP |
---|
| 48 | INTEGER_M :: KDIM |
---|
| 49 | |
---|
| 50 | ! DUMMY REAL SCALARS |
---|
| 51 | REAL_B :: PSIN |
---|
| 52 | |
---|
| 53 | REAL_B :: PALP(KDIM) |
---|
| 54 | |
---|
| 55 | ! LOCAL INTEGER SCALARS |
---|
| 56 | INTEGER_M :: IC, ICP, II, IM, IM2, JM1, JN |
---|
| 57 | |
---|
| 58 | ! LOCAL REAL SCALARS |
---|
| 59 | REAL_B :: Z2M, ZCOS, ZE1, ZE2, ZF1M, ZF2M, ZM, ZN, ZN2, ZRE1, ZSIN |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | ! ------------------------------------------------------------------ |
---|
| 63 | |
---|
| 64 | !* 1. PRELIMINARY SETTING. |
---|
| 65 | ! ----------- -------- |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | ZSIN=PSIN |
---|
| 69 | ICP=KCP |
---|
| 70 | |
---|
| 71 | ! ------------------------------------------------------------------ |
---|
| 72 | |
---|
| 73 | !* 2. COMPUTATIONS. |
---|
| 74 | ! ------------- |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | IC=ICP-1 |
---|
| 78 | ZCOS=SQRT(_ONE_-ZSIN**2) |
---|
| 79 | II=2 |
---|
| 80 | PALP(1)=_ONE_ |
---|
| 81 | ZF1M=SQRT(3._JPRB) |
---|
| 82 | PALP(2)=ZF1M*ZSIN |
---|
| 83 | DO 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 |
---|
| 109 | ENDDO |
---|
| 110 | |
---|
| 111 | ! ------------------------------------------------------------------ |
---|
| 112 | |
---|
| 113 | !* 3. RETURN. |
---|
| 114 | ! ------- |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | RETURN |
---|
| 118 | END SUBROUTINE LEGTRI |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | |
---|