FACT++  1.0
int eraStarpv ( double  ra,
double  dec,
double  pmr,
double  pmd,
double  px,
double  rv,
double  pv[2][3] 
)

Definition at line 3 of file starpv.c.

References eraPdp(), eraPm(), eraPmp(), eraPn(), eraPpp(), eraS2pv(), eraSxp(), eraZp(), ERFA_DAU, ERFA_DAYSEC, ERFA_DC, ERFA_DJY, ERFA_DR2AS, and i.

Referenced by eraFk52h(), eraH2fk5(), eraStarpm(), and t_starpv().

119 {
120 /* Smallest allowed parallax */
121  static const double PXMIN = 1e-7;
122 
123 /* Largest allowed speed (fraction of c) */
124  static const double VMAX = 0.5;
125 
126 /* Maximum number of iterations for relativistic solution */
127  static const int IMAX = 100;
128 
129  int i, iwarn;
130  double w, r, rd, rad, decd, v, x[3], usr[3], ust[3],
131  vsr, vst, betst, betsr, bett, betr,
132  dd, ddel, ur[3], ut[3],
133  d = 0.0, del = 0.0, /* to prevent */
134  odd = 0.0, oddel = 0.0, /* compiler */
135  od = 0.0, odel = 0.0; /* warnings */
136 
137 /* Distance (AU). */
138  if (px >= PXMIN) {
139  w = px;
140  iwarn = 0;
141  } else {
142  w = PXMIN;
143  iwarn = 1;
144  }
145  r = ERFA_DR2AS / w;
146 
147 /* Radial velocity (AU/day). */
148  rd = ERFA_DAYSEC * rv * 1e3 / ERFA_DAU;
149 
150 /* Proper motion (radian/day). */
151  rad = pmr / ERFA_DJY;
152  decd = pmd / ERFA_DJY;
153 
154 /* To pv-vector (AU,AU/day). */
155  eraS2pv(ra, dec, r, rad, decd, rd, pv);
156 
157 /* If excessive velocity, arbitrarily set it to zero. */
158  v = eraPm(pv[1]);
159  if (v / ERFA_DC > VMAX) {
160  eraZp(pv[1]);
161  iwarn += 2;
162  }
163 
164 /* Isolate the radial component of the velocity (AU/day). */
165  eraPn(pv[0], &w, x);
166  vsr = eraPdp(x, pv[1]);
167  eraSxp(vsr, x, usr);
168 
169 /* Isolate the transverse component of the velocity (AU/day). */
170  eraPmp(pv[1], usr, ust);
171  vst = eraPm(ust);
172 
173 /* Special-relativity dimensionless parameters. */
174  betsr = vsr / ERFA_DC;
175  betst = vst / ERFA_DC;
176 
177 /* Determine the inertial-to-observed relativistic correction terms. */
178  bett = betst;
179  betr = betsr;
180  for (i = 0; i < IMAX; i++) {
181  d = 1.0 + betr;
182  del = sqrt(1.0 - betr*betr - bett*bett) - 1.0;
183  betr = d * betsr + del;
184  bett = d * betst;
185  if (i > 0) {
186  dd = fabs(d - od);
187  ddel = fabs(del - odel);
188  if ((i > 1) && (dd >= odd) && (ddel >= oddel)) break;
189  odd = dd;
190  oddel = ddel;
191  }
192  od = d;
193  odel = del;
194  }
195  if (i >= IMAX) iwarn += 4;
196 
197 /* Replace observed radial velocity with inertial value. */
198  w = (betsr != 0.0) ? d + del / betsr : 1.0;
199  eraSxp(w, usr, ur);
200 
201 /* Replace observed tangential velocity with inertial value. */
202  eraSxp(d, ust, ut);
203 
204 /* Combine the two to obtain the inertial space velocity. */
205  eraPpp(ur, ut, pv[1]);
206 
207 /* Return the status. */
208  return iwarn;
209 
210 }
double eraPdp(double a[3], double b[3])
Definition: pdp.c:3
#define ERFA_DAU
Definition: erfam.h:102
#define ERFA_DJY
Definition: erfam.h:78
int i
Definition: db_dim_client.c:21
#define ERFA_DC
Definition: erfam.h:111
#define ERFA_DR2AS
Definition: erfam.h:57
double eraPm(double p[3])
Definition: pm.c:3
#define ERFA_DAYSEC
Definition: erfam.h:75
void eraPpp(double a[3], double b[3], double apb[3])
Definition: ppp.c:3
void eraSxp(double s, double p[3], double sp[3])
Definition: sxp.c:3
void eraPmp(double a[3], double b[3], double amb[3])
Definition: pmp.c:3
void eraPn(double p[3], double *r, double u[3])
Definition: pn.c:3
void eraZp(double p[3])
Definition: zp.c:3
void eraS2pv(double theta, double phi, double r, double td, double pd, double rd, double pv[2][3])
Definition: s2pv.c:3

+ Here is the call graph for this function:

+ Here is the caller graph for this function: