| 1 | SUBROUTINE mucorr(npts,lon_sun, 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 lon_sun solar longitude (radians!!) |
|---|
| 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 | #include "comorbit.h" |
|---|
| 32 | |
|---|
| 33 | c Arguments : |
|---|
| 34 | c ----------- |
|---|
| 35 | INTEGER npts |
|---|
| 36 | REAL plat(npts),pmu(npts), pfract(npts) |
|---|
| 37 | REAL lon_sun |
|---|
| 38 | c |
|---|
| 39 | c Local variables : |
|---|
| 40 | c ----------------- |
|---|
| 41 | INTEGER j |
|---|
| 42 | REAL z,cz,sz,tz,phi,cphi,sphi,tphi |
|---|
| 43 | REAL ap,a,t,b,tp |
|---|
| 44 | real pdeclin,incl |
|---|
| 45 | |
|---|
| 46 | c----------------------------------------------------------------------- |
|---|
| 47 | |
|---|
| 48 | c verifs |
|---|
| 49 | c print*,"LATITUDES=",plat(1),plat(npts/2),plat(npts) |
|---|
| 50 | c print*,"zls=",lon_sun*180/RPI |
|---|
| 51 | |
|---|
| 52 | incl=obliquit * RPI / 180. ! obliquite en radian |
|---|
| 53 | pdeclin = ASIN (SIN(lon_sun)*SIN(incl) ) ! declin en radian |
|---|
| 54 | c print*,'npts,pdeclin',npts,pdeclin*180./RPI |
|---|
| 55 | z = pdeclin |
|---|
| 56 | cz = cos (z) |
|---|
| 57 | sz = sin (z) |
|---|
| 58 | c print*,'cz,sz',cz,sz |
|---|
| 59 | |
|---|
| 60 | DO 20 j = 1, npts |
|---|
| 61 | |
|---|
| 62 | phi = plat(j)*RPI/180. ! latitude en radian |
|---|
| 63 | cphi = cos(phi) |
|---|
| 64 | if (cphi.le.1.e-9) cphi=1.e-9 |
|---|
| 65 | sphi = sin(phi) |
|---|
| 66 | tphi = sphi / cphi |
|---|
| 67 | b = cphi * cz |
|---|
| 68 | t = -tphi * sz / cz |
|---|
| 69 | a = 1.0 - t*t |
|---|
| 70 | ap = a |
|---|
| 71 | |
|---|
| 72 | IF(t.eq.0.) then |
|---|
| 73 | t=0.5*RPI |
|---|
| 74 | ELSE |
|---|
| 75 | IF (a.lt.0.) a = 0. |
|---|
| 76 | t = sqrt(a) / t |
|---|
| 77 | IF (t.lt.0.) then |
|---|
| 78 | tp = -atan (-t) + RPI |
|---|
| 79 | ELSE |
|---|
| 80 | tp = atan(t) |
|---|
| 81 | ENDIF |
|---|
| 82 | t = tp |
|---|
| 83 | ENDIF |
|---|
| 84 | |
|---|
| 85 | pmu(j) = (sphi*sz*t) / RPI + b*sin(t)/RPI |
|---|
| 86 | pfract(j) = t / RPI |
|---|
| 87 | IF (ap .lt.0.) then |
|---|
| 88 | pmu(j) = sphi * sz |
|---|
| 89 | pfract(j) = 1.0 |
|---|
| 90 | ENDIF |
|---|
| 91 | |
|---|
| 92 | IF (pmu(j).le.0.0) pmu(j) = 0.0 |
|---|
| 93 | pmu(j) = pmu(j) / pfract(j) |
|---|
| 94 | IF (pmu(j).eq.0.) pfract(j) = 0. |
|---|
| 95 | |
|---|
| 96 | 20 CONTINUE |
|---|
| 97 | c call dump2d(48,31,pfract(2),'FRACT ') |
|---|
| 98 | c call dump2d(48,31,pmu(2),'MU0 ') |
|---|
| 99 | c stop |
|---|
| 100 | |
|---|
| 101 | c----------------------------------------------------------------------- |
|---|
| 102 | c correction de rotondite: |
|---|
| 103 | c ------------------------ |
|---|
| 104 | |
|---|
| 105 | c print*,'dans mucorr avant correction rotondite' |
|---|
| 106 | c print*,'pmu(1)=',pmu(1),' pmu(npts/2)=',pmu(npts/2) |
|---|
| 107 | c print*,'pfract(1)=',pfract(1),' pfract(npts/2)=',pfract(npts/2) |
|---|
| 108 | |
|---|
| 109 | DO 30 j=1,npts |
|---|
| 110 | c !!!!!! |
|---|
| 111 | pmu(j)=sqrt(1224.*pmu(j)*pmu(j)+1.)/35. |
|---|
| 112 | 30 CONTINUE |
|---|
| 113 | |
|---|
| 114 | c print*,'dans mucorr apres correction rotondite' |
|---|
| 115 | c print*,'pmu(1)=',pmu(1),' pmu(npts/2)=',pmu(npts/2) |
|---|
| 116 | |
|---|
| 117 | c print*,"pmu=",pmu(1),pmu(npts/2),pmu(npts) |
|---|
| 118 | c print*,"pfract=",pfract(1),pfract(npts/2),pfract(npts) |
|---|
| 119 | RETURN |
|---|
| 120 | END |
|---|