1 | SUBROUTINE mucorr(npts,plongi, plat, pmu, pfract) |
---|
2 | IMPLICIT NONE |
---|
3 | |
---|
4 | c======================================================================= |
---|
5 | c |
---|
6 | c Calcul of equivalent solar angle and and fraction of day whithout |
---|
7 | c diurnal cycle. |
---|
8 | c |
---|
9 | c parmeters : |
---|
10 | c ----------- |
---|
11 | c |
---|
12 | c Input : |
---|
13 | c ------- |
---|
14 | c npts number of points |
---|
15 | c plongi solar longitude (degres) |
---|
16 | c plat(npts) latitude (en degres) |
---|
17 | c |
---|
18 | c Output : |
---|
19 | c -------- |
---|
20 | c pmu(npts) equivalent cosinus of the solar angle |
---|
21 | c pfract(npts) fractionnal day |
---|
22 | c |
---|
23 | c======================================================================= |
---|
24 | |
---|
25 | c----------------------------------------------------------------------- |
---|
26 | c |
---|
27 | c 0. Declarations : |
---|
28 | c ----------------- |
---|
29 | |
---|
30 | #include "YOMCST.h" |
---|
31 | |
---|
32 | c Arguments : |
---|
33 | c ----------- |
---|
34 | INTEGER npts |
---|
35 | REAL plat(npts),pmu(npts), pfract(npts) |
---|
36 | REAL plongi |
---|
37 | c |
---|
38 | c Local variables : |
---|
39 | c ----------------- |
---|
40 | INTEGER j |
---|
41 | REAL pi |
---|
42 | REAL z,cz,sz,tz,phi,cphi,sphi,tphi |
---|
43 | REAL ap,a,t,b,tp |
---|
44 | real pdeclin,incl,lon_sun |
---|
45 | |
---|
46 | c----------------------------------------------------------------------- |
---|
47 | |
---|
48 | c pi = 4. * atan(1.0) |
---|
49 | c print*,'PI=',pi |
---|
50 | pi=2.*asin(1.) |
---|
51 | c print*,'PI=B',pi |
---|
52 | |
---|
53 | incl=R_incl * pi / 180. ! obliquite en radian |
---|
54 | lon_sun = plongi * pi / 180.0 ! Ls en radian |
---|
55 | pdeclin = ASIN (SIN(lon_sun)*SIN(incl) ) ! declin en radian |
---|
56 | c print*,'npts,pdeclin',npts,pdeclin*180./pi |
---|
57 | z = pdeclin |
---|
58 | cz = cos (z) |
---|
59 | sz = sin (z) |
---|
60 | c print*,'cz,sz',cz,sz |
---|
61 | |
---|
62 | DO 20 j = 1, npts |
---|
63 | |
---|
64 | phi = plat(j)*pi/180. ! latitude en radian |
---|
65 | cphi = cos(phi) |
---|
66 | if (cphi.le.1.e-9) cphi=1.e-9 |
---|
67 | sphi = sin(phi) |
---|
68 | tphi = sphi / cphi |
---|
69 | b = cphi * cz |
---|
70 | t = -tphi * sz / cz |
---|
71 | a = 1.0 - t*t |
---|
72 | ap = a |
---|
73 | |
---|
74 | IF(t.eq.0.) then |
---|
75 | t=0.5*pi |
---|
76 | ELSE |
---|
77 | IF (a.lt.0.) a = 0. |
---|
78 | t = sqrt(a) / t |
---|
79 | IF (t.lt.0.) then |
---|
80 | tp = -atan (-t) + pi |
---|
81 | ELSE |
---|
82 | tp = atan(t) |
---|
83 | ENDIF |
---|
84 | t = tp |
---|
85 | ENDIF |
---|
86 | |
---|
87 | pmu(j) = (sphi*sz*t) / pi + b*sin(t)/pi |
---|
88 | pfract(j) = t / pi |
---|
89 | IF (ap .lt.0.) then |
---|
90 | pmu(j) = sphi * sz |
---|
91 | pfract(j) = 1.0 |
---|
92 | ENDIF |
---|
93 | |
---|
94 | IF (pmu(j).le.0.0) pmu(j) = 0.0 |
---|
95 | pmu(j) = pmu(j) / pfract(j) |
---|
96 | IF (pmu(j).eq.0.) pfract(j) = 0. |
---|
97 | |
---|
98 | 20 CONTINUE |
---|
99 | c call dump2d(48,31,pfract(2),'FRACT ') |
---|
100 | c call dump2d(48,31,pmu(2),'MU0 ') |
---|
101 | c stop |
---|
102 | |
---|
103 | c----------------------------------------------------------------------- |
---|
104 | c correction de rotondite: |
---|
105 | c ------------------------ |
---|
106 | |
---|
107 | c print*,'dans mucorr avant correction rotondite' |
---|
108 | c print*,'pmu(1)=',pmu(1),' pmu(npts/2)=',pmu(npts/2) |
---|
109 | c print*,'pfract(1)=',pfract(1),' pfract(npts/2)=',pfract(npts/2) |
---|
110 | |
---|
111 | DO 30 j=1,npts |
---|
112 | c !!!!!! |
---|
113 | pmu(j)=sqrt(1224.*pmu(j)*pmu(j)+1.)/35. |
---|
114 | 30 CONTINUE |
---|
115 | |
---|
116 | c print*,'dans mucorr apres correction rotondite' |
---|
117 | c print*,'pmu(1)=',pmu(1),' pmu(npts/2)=',pmu(npts/2) |
---|
118 | |
---|
119 | RETURN |
---|
120 | END |
---|