194 const double D93 = 1.623156204;
196 const double GCR = 8314.32;
198 const double DMD = 28.9644;
200 const double DMW = 18.0152;
202 const double S = 6378120.;
204 const double DELTA = 18.36;
206 const double HT = 11000.;
208 const double HS = 80000.;
210 const int ISMAX=16384l;
217 double zobs1,zobs2,hmok,tdkok,pmbok,rhok,wlok,alpha,
218 tol,wlsq,gb,a,gamal,gamma,gamm2,delm2,
220 c1,c2,c3,c4,c5,c6,r0,tempo,dn0,rdndr0,sk0,f0,
221 rt,tt,dnt,rdndrt,sine,zt,ft,dnts,rdndrp,zts,fts,
222 rs,dns,rdndrs,zs,fs,refold,z0,zrange,fb,ff,fo,fe,
223 h,r,sz,rg,dr,tg,dn,rdndr,
t,f,refp,reft;
226 #define refi(DN,RDNDR) RDNDR/(DN+RDNDR) 230 zobs2 =
DMIN(fabs(zobs1),D93);
234 tdkok =
DMIN(
DMAX(tdk,100.0),500.0);
235 pmbok =
DMIN(
DMAX(pmb,0.0),10000.0);
238 alpha =
DMIN(
DMAX(fabs(tlr),0.001),0.01);
241 tol =
DMIN(
DMAX(fabs(eps),1e-12),0.1)/2.0;
244 optic = wlok < 100.0;
248 gb = 9.784*(1.0-0.0026*cos(phi+phi)-0.00000028*hmok);
250 a = (287.6155+(1.62887+0.01360/wlsq)/wlsq) * 273.15e-6/1013.25;
254 gamal = (gb*DMD)/GCR;
259 psat = pow(10.0,(0.7859+0.03477*tdc)/(1.0+0.00412*tdc)) *
260 (1.0+pmbok*(4.5e-6+6.0e-10*tdc*tdc));
262 pwo = rhok*psat/(1.0-(1.0-rhok)*psat/pmbok);
266 w = pwo*(1.0-DMW/DMD)*gamma/(DELTA-gamma);
267 c1 = a*(pmbok+
w)/tdkok;
269 c2 = (a*w+11.2684e-6*pwo)/tdkok;
271 c2 = (a*w+6.3938e-6*pwo)/tdkok;
273 c3 = (gamma-1.0)*alpha*c1/tdkok;
274 c4 = (DELTA-1.0)*alpha*c2/tdkok;
279 c5 = 375463e-6*pwo/tdkok;
280 c6 = c5*delm2*alpha/(tdkok*tdkok);
285 pal1Atmt(r0,tdkok,alpha,gamm2,delm2,c1,c2,c3,c4,c5,c6,
286 r0,&tempo,&dn0,&rdndr0);
287 sk0 = dn0*r0*sin(zobs2);
288 f0 =
refi(dn0,rdndr0);
291 rt = S+
DMAX(HT,hmok);
292 pal1Atmt(r0,tdkok,alpha,gamm2,delm2,c1,c2,c3,c4,c5,c6,
293 rt,&tt,&dnt,&rdndrt);
295 zt = atan2(sine,sqrt(
DMAX(1.0-sine*sine,0.0)));
296 ft =
refi(dnt,rdndrt);
299 pal1Atms(rt,tt,dnt,gamal,rt,&dnts,&rdndrp);
300 sine = sk0/(rt*dnts);
301 zts = atan2(sine,sqrt(
DMAX(1.0-sine*sine,0.0)));
302 fts =
refi(dnts,rdndrp);
306 pal1Atms(rt,tt,dnt,gamal,rs,&dns,&rdndrs);
308 zs = atan2(sine,sqrt(
DMAX(1.0-sine*sine,0.0)));
309 fs =
refi(dns,rdndrs);
317 for (k=1; k<=2; k++) {
350 h = zrange/((double)is);
360 for (i=1; i<is; i+=n) {
363 sz = sin(z0+h*(
double)(i));
371 while ( fabs(dr) > 1.0 && j < 4 ) {
374 pal1Atmt(r0,tdkok,alpha,gamm2,delm2,
375 c1,c2,c3,c4,c5,c6,rg,&tg,&dn,&rdndr);
377 pal1Atms(rt,tt,dnt,gamal,rg,&dn,&rdndr);
379 dr = (rg*dn-
w)/(dn+rdndr);
387 pal1Atmt(r0,tdkok,alpha,gamm2,delm2,
388 c1,c2,c3,c4,c5,c6,r,&t,&dn,&rdndr);
390 pal1Atms(rt,tt,dnt,gamal,r,&dn,&rdndr);
395 if (n==1 && i%2 == 0) {
403 refp = h*(fb+4.0*fo+2.0*fe+ff)/3.0;
406 if (fabs(refp-refold) > tol && is < ISMAX) {
427 if (k==1) reft = refp;
435 if (zobs1 < 0.0) *ref = -(*ref);
double palDrange(double angle)
void pal1Atmt(double r0, double t0, double alpha, double gamm2, double delm2, double c1, double c2, double c3, double c4, double c5, double c6, double r, double *t, double *dn, double *rdndr)
void pal1Atms(double rt, double tt, double dnt, double gamal, double r, double *dn, double *rdndr)