| 1 | #include "sofa.h"
|
|---|
| 2 |
|
|---|
| 3 | int iauStarpv(double ra, double dec,
|
|---|
| 4 | double pmr, double pmd, double px, double rv,
|
|---|
| 5 | double pv[2][3])
|
|---|
| 6 | /*
|
|---|
| 7 | ** - - - - - - - - - -
|
|---|
| 8 | ** i a u S t a r p v
|
|---|
| 9 | ** - - - - - - - - - -
|
|---|
| 10 | **
|
|---|
| 11 | ** Convert star catalog coordinates to position+velocity vector.
|
|---|
| 12 | **
|
|---|
| 13 | ** This function is part of the International Astronomical Union's
|
|---|
| 14 | ** SOFA (Standards Of Fundamental Astronomy) software collection.
|
|---|
| 15 | **
|
|---|
| 16 | ** Status: support function.
|
|---|
| 17 | **
|
|---|
| 18 | ** Given (Note 1):
|
|---|
| 19 | ** ra double right ascension (radians)
|
|---|
| 20 | ** dec double declination (radians)
|
|---|
| 21 | ** pmr double RA proper motion (radians/year)
|
|---|
| 22 | ** pmd double Dec proper motion (radians/year)
|
|---|
| 23 | ** px double parallax (arcseconds)
|
|---|
| 24 | ** rv double radial velocity (km/s, positive = receding)
|
|---|
| 25 | **
|
|---|
| 26 | ** Returned (Note 2):
|
|---|
| 27 | ** pv double[2][3] pv-vector (AU, AU/day)
|
|---|
| 28 | **
|
|---|
| 29 | ** Returned (function value):
|
|---|
| 30 | ** int status:
|
|---|
| 31 | ** 0 = no warnings
|
|---|
| 32 | ** 1 = distance overridden (Note 6)
|
|---|
| 33 | ** 2 = excessive speed (Note 7)
|
|---|
| 34 | ** 4 = solution didn't converge (Note 8)
|
|---|
| 35 | ** else = binary logical OR of the above
|
|---|
| 36 | **
|
|---|
| 37 | ** Notes:
|
|---|
| 38 | **
|
|---|
| 39 | ** 1) The star data accepted by this function are "observables" for an
|
|---|
| 40 | ** imaginary observer at the solar-system barycenter. Proper motion
|
|---|
| 41 | ** and radial velocity are, strictly, in terms of barycentric
|
|---|
| 42 | ** coordinate time, TCB. For most practical applications, it is
|
|---|
| 43 | ** permissible to neglect the distinction between TCB and ordinary
|
|---|
| 44 | ** "proper" time on Earth (TT/TAI). The result will, as a rule, be
|
|---|
| 45 | ** limited by the intrinsic accuracy of the proper-motion and
|
|---|
| 46 | ** radial-velocity data; moreover, the pv-vector is likely to be
|
|---|
| 47 | ** merely an intermediate result, so that a change of time unit
|
|---|
| 48 | ** would cancel out overall.
|
|---|
| 49 | **
|
|---|
| 50 | ** In accordance with normal star-catalog conventions, the object's
|
|---|
| 51 | ** right ascension and declination are freed from the effects of
|
|---|
| 52 | ** secular aberration. The frame, which is aligned to the catalog
|
|---|
| 53 | ** equator and equinox, is Lorentzian and centered on the SSB.
|
|---|
| 54 | **
|
|---|
| 55 | ** 2) The resulting position and velocity pv-vector is with respect to
|
|---|
| 56 | ** the same frame and, like the catalog coordinates, is freed from
|
|---|
| 57 | ** the effects of secular aberration. Should the "coordinate
|
|---|
| 58 | ** direction", where the object was located at the catalog epoch, be
|
|---|
| 59 | ** required, it may be obtained by calculating the magnitude of the
|
|---|
| 60 | ** position vector pv[0][0-2] dividing by the speed of light in
|
|---|
| 61 | ** AU/day to give the light-time, and then multiplying the space
|
|---|
| 62 | ** velocity pv[1][0-2] by this light-time and adding the result to
|
|---|
| 63 | ** pv[0][0-2].
|
|---|
| 64 | **
|
|---|
| 65 | ** Summarizing, the pv-vector returned is for most stars almost
|
|---|
| 66 | ** identical to the result of applying the standard geometrical
|
|---|
| 67 | ** "space motion" transformation. The differences, which are the
|
|---|
| 68 | ** subject of the Stumpff paper referenced below, are:
|
|---|
| 69 | **
|
|---|
| 70 | ** (i) In stars with significant radial velocity and proper motion,
|
|---|
| 71 | ** the constantly changing light-time distorts the apparent proper
|
|---|
| 72 | ** motion. Note that this is a classical, not a relativistic,
|
|---|
| 73 | ** effect.
|
|---|
| 74 | **
|
|---|
| 75 | ** (ii) The transformation complies with special relativity.
|
|---|
| 76 | **
|
|---|
| 77 | ** 3) Care is needed with units. The star coordinates are in radians
|
|---|
| 78 | ** and the proper motions in radians per Julian year, but the
|
|---|
| 79 | ** parallax is in arcseconds; the radial velocity is in km/s, but
|
|---|
| 80 | ** the pv-vector result is in AU and AU/day.
|
|---|
| 81 | **
|
|---|
| 82 | ** 4) The RA proper motion is in terms of coordinate angle, not true
|
|---|
| 83 | ** angle. If the catalog uses arcseconds for both RA and Dec proper
|
|---|
| 84 | ** motions, the RA proper motion will need to be divided by cos(Dec)
|
|---|
| 85 | ** before use.
|
|---|
| 86 | **
|
|---|
| 87 | ** 5) Straight-line motion at constant speed, in the inertial frame,
|
|---|
| 88 | ** is assumed.
|
|---|
| 89 | **
|
|---|
| 90 | ** 6) An extremely small (or zero or negative) parallax is interpreted
|
|---|
| 91 | ** to mean that the object is on the "celestial sphere", the radius
|
|---|
| 92 | ** of which is an arbitrary (large) value (see the constant PXMIN).
|
|---|
| 93 | ** When the distance is overridden in this way, the status,
|
|---|
| 94 | ** initially zero, has 1 added to it.
|
|---|
| 95 | **
|
|---|
| 96 | ** 7) If the space velocity is a significant fraction of c (see the
|
|---|
| 97 | ** constant VMAX), it is arbitrarily set to zero. When this action
|
|---|
| 98 | ** occurs, 2 is added to the status.
|
|---|
| 99 | **
|
|---|
| 100 | ** 8) The relativistic adjustment involves an iterative calculation.
|
|---|
| 101 | ** If the process fails to converge within a set number (IMAX) of
|
|---|
| 102 | ** iterations, 4 is added to the status.
|
|---|
| 103 | **
|
|---|
| 104 | ** 9) The inverse transformation is performed by the function
|
|---|
| 105 | ** iauPvstar.
|
|---|
| 106 | **
|
|---|
| 107 | ** Called:
|
|---|
| 108 | ** iauS2pv spherical coordinates to pv-vector
|
|---|
| 109 | ** iauPm modulus of p-vector
|
|---|
| 110 | ** iauZp zero p-vector
|
|---|
| 111 | ** iauPn decompose p-vector into modulus and direction
|
|---|
| 112 | ** iauPdp scalar product of two p-vectors
|
|---|
| 113 | ** iauSxp multiply p-vector by scalar
|
|---|
| 114 | ** iauPmp p-vector minus p-vector
|
|---|
| 115 | ** iauPpp p-vector plus p-vector
|
|---|
| 116 | **
|
|---|
| 117 | ** Reference:
|
|---|
| 118 | **
|
|---|
| 119 | ** Stumpff, P., 1985, Astron.Astrophys. 144, 232-240.
|
|---|
| 120 | **
|
|---|
| 121 | ** This revision: 2013 June 18
|
|---|
| 122 | **
|
|---|
| 123 | ** SOFA release 2015-02-09
|
|---|
| 124 | **
|
|---|
| 125 | ** Copyright (C) 2015 IAU SOFA Board. See notes at end.
|
|---|
| 126 | */
|
|---|
| 127 | {
|
|---|
| 128 | /* Smallest allowed parallax */
|
|---|
| 129 | static const double PXMIN = 1e-7;
|
|---|
| 130 |
|
|---|
| 131 | /* Largest allowed speed (fraction of c) */
|
|---|
| 132 | static const double VMAX = 0.5;
|
|---|
| 133 |
|
|---|
| 134 | /* Maximum number of iterations for relativistic solution */
|
|---|
| 135 | static const int IMAX = 100;
|
|---|
| 136 |
|
|---|
| 137 | int i, iwarn;
|
|---|
| 138 | double w, r, rd, rad, decd, v, x[3], usr[3], ust[3],
|
|---|
| 139 | vsr, vst, betst, betsr, bett, betr,
|
|---|
| 140 | dd, ddel, ur[3], ut[3],
|
|---|
| 141 | d = 0.0, del = 0.0, /* to prevent */
|
|---|
| 142 | odd = 0.0, oddel = 0.0, /* compiler */
|
|---|
| 143 | od = 0.0, odel = 0.0; /* warnings */
|
|---|
| 144 |
|
|---|
| 145 | /* Distance (AU). */
|
|---|
| 146 | if (px >= PXMIN) {
|
|---|
| 147 | w = px;
|
|---|
| 148 | iwarn = 0;
|
|---|
| 149 | } else {
|
|---|
| 150 | w = PXMIN;
|
|---|
| 151 | iwarn = 1;
|
|---|
| 152 | }
|
|---|
| 153 | r = DR2AS / w;
|
|---|
| 154 |
|
|---|
| 155 | /* Radial velocity (AU/day). */
|
|---|
| 156 | rd = DAYSEC * rv * 1e3 / DAU;
|
|---|
| 157 |
|
|---|
| 158 | /* Proper motion (radian/day). */
|
|---|
| 159 | rad = pmr / DJY;
|
|---|
| 160 | decd = pmd / DJY;
|
|---|
| 161 |
|
|---|
| 162 | /* To pv-vector (AU,AU/day). */
|
|---|
| 163 | iauS2pv(ra, dec, r, rad, decd, rd, pv);
|
|---|
| 164 |
|
|---|
| 165 | /* If excessive velocity, arbitrarily set it to zero. */
|
|---|
| 166 | v = iauPm(pv[1]);
|
|---|
| 167 | if (v / DC > VMAX) {
|
|---|
| 168 | iauZp(pv[1]);
|
|---|
| 169 | iwarn += 2;
|
|---|
| 170 | }
|
|---|
| 171 |
|
|---|
| 172 | /* Isolate the radial component of the velocity (AU/day). */
|
|---|
| 173 | iauPn(pv[0], &w, x);
|
|---|
| 174 | vsr = iauPdp(x, pv[1]);
|
|---|
| 175 | iauSxp(vsr, x, usr);
|
|---|
| 176 |
|
|---|
| 177 | /* Isolate the transverse component of the velocity (AU/day). */
|
|---|
| 178 | iauPmp(pv[1], usr, ust);
|
|---|
| 179 | vst = iauPm(ust);
|
|---|
| 180 |
|
|---|
| 181 | /* Special-relativity dimensionless parameters. */
|
|---|
| 182 | betsr = vsr / DC;
|
|---|
| 183 | betst = vst / DC;
|
|---|
| 184 |
|
|---|
| 185 | /* Determine the inertial-to-observed relativistic correction terms. */
|
|---|
| 186 | bett = betst;
|
|---|
| 187 | betr = betsr;
|
|---|
| 188 | for (i = 0; i < IMAX; i++) {
|
|---|
| 189 | d = 1.0 + betr;
|
|---|
| 190 | del = sqrt(1.0 - betr*betr - bett*bett) - 1.0;
|
|---|
| 191 | betr = d * betsr + del;
|
|---|
| 192 | bett = d * betst;
|
|---|
| 193 | if (i > 0) {
|
|---|
| 194 | dd = fabs(d - od);
|
|---|
| 195 | ddel = fabs(del - odel);
|
|---|
| 196 | if ((i > 1) && (dd >= odd) && (ddel >= oddel)) break;
|
|---|
| 197 | odd = dd;
|
|---|
| 198 | oddel = ddel;
|
|---|
| 199 | }
|
|---|
| 200 | od = d;
|
|---|
| 201 | odel = del;
|
|---|
| 202 | }
|
|---|
| 203 | if (i >= IMAX) iwarn += 4;
|
|---|
| 204 |
|
|---|
| 205 | /* Replace observed radial velocity with inertial value. */
|
|---|
| 206 | w = (betsr != 0.0) ? d + del / betsr : 1.0;
|
|---|
| 207 | iauSxp(w, usr, ur);
|
|---|
| 208 |
|
|---|
| 209 | /* Replace observed tangential velocity with inertial value. */
|
|---|
| 210 | iauSxp(d, ust, ut);
|
|---|
| 211 |
|
|---|
| 212 | /* Combine the two to obtain the inertial space velocity. */
|
|---|
| 213 | iauPpp(ur, ut, pv[1]);
|
|---|
| 214 |
|
|---|
| 215 | /* Return the status. */
|
|---|
| 216 | return iwarn;
|
|---|
| 217 |
|
|---|
| 218 | /*----------------------------------------------------------------------
|
|---|
| 219 | **
|
|---|
| 220 | ** Copyright (C) 2015
|
|---|
| 221 | ** Standards Of Fundamental Astronomy Board
|
|---|
| 222 | ** of the International Astronomical Union.
|
|---|
| 223 | **
|
|---|
| 224 | ** =====================
|
|---|
| 225 | ** SOFA Software License
|
|---|
| 226 | ** =====================
|
|---|
| 227 | **
|
|---|
| 228 | ** NOTICE TO USER:
|
|---|
| 229 | **
|
|---|
| 230 | ** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
|
|---|
| 231 | ** CONDITIONS WHICH APPLY TO ITS USE.
|
|---|
| 232 | **
|
|---|
| 233 | ** 1. The Software is owned by the IAU SOFA Board ("SOFA").
|
|---|
| 234 | **
|
|---|
| 235 | ** 2. Permission is granted to anyone to use the SOFA software for any
|
|---|
| 236 | ** purpose, including commercial applications, free of charge and
|
|---|
| 237 | ** without payment of royalties, subject to the conditions and
|
|---|
| 238 | ** restrictions listed below.
|
|---|
| 239 | **
|
|---|
| 240 | ** 3. You (the user) may copy and distribute SOFA source code to others,
|
|---|
| 241 | ** and use and adapt its code and algorithms in your own software,
|
|---|
| 242 | ** on a world-wide, royalty-free basis. That portion of your
|
|---|
| 243 | ** distribution that does not consist of intact and unchanged copies
|
|---|
| 244 | ** of SOFA source code files is a "derived work" that must comply
|
|---|
| 245 | ** with the following requirements:
|
|---|
| 246 | **
|
|---|
| 247 | ** a) Your work shall be marked or carry a statement that it
|
|---|
| 248 | ** (i) uses routines and computations derived by you from
|
|---|
| 249 | ** software provided by SOFA under license to you; and
|
|---|
| 250 | ** (ii) does not itself constitute software provided by and/or
|
|---|
| 251 | ** endorsed by SOFA.
|
|---|
| 252 | **
|
|---|
| 253 | ** b) The source code of your derived work must contain descriptions
|
|---|
| 254 | ** of how the derived work is based upon, contains and/or differs
|
|---|
| 255 | ** from the original SOFA software.
|
|---|
| 256 | **
|
|---|
| 257 | ** c) The names of all routines in your derived work shall not
|
|---|
| 258 | ** include the prefix "iau" or "sofa" or trivial modifications
|
|---|
| 259 | ** thereof such as changes of case.
|
|---|
| 260 | **
|
|---|
| 261 | ** d) The origin of the SOFA components of your derived work must
|
|---|
| 262 | ** not be misrepresented; you must not claim that you wrote the
|
|---|
| 263 | ** original software, nor file a patent application for SOFA
|
|---|
| 264 | ** software or algorithms embedded in the SOFA software.
|
|---|
| 265 | **
|
|---|
| 266 | ** e) These requirements must be reproduced intact in any source
|
|---|
| 267 | ** distribution and shall apply to anyone to whom you have
|
|---|
| 268 | ** granted a further right to modify the source code of your
|
|---|
| 269 | ** derived work.
|
|---|
| 270 | **
|
|---|
| 271 | ** Note that, as originally distributed, the SOFA software is
|
|---|
| 272 | ** intended to be a definitive implementation of the IAU standards,
|
|---|
| 273 | ** and consequently third-party modifications are discouraged. All
|
|---|
| 274 | ** variations, no matter how minor, must be explicitly marked as
|
|---|
| 275 | ** such, as explained above.
|
|---|
| 276 | **
|
|---|
| 277 | ** 4. You shall not cause the SOFA software to be brought into
|
|---|
| 278 | ** disrepute, either by misuse, or use for inappropriate tasks, or
|
|---|
| 279 | ** by inappropriate modification.
|
|---|
| 280 | **
|
|---|
| 281 | ** 5. The SOFA software is provided "as is" and SOFA makes no warranty
|
|---|
| 282 | ** as to its use or performance. SOFA does not and cannot warrant
|
|---|
| 283 | ** the performance or results which the user may obtain by using the
|
|---|
| 284 | ** SOFA software. SOFA makes no warranties, express or implied, as
|
|---|
| 285 | ** to non-infringement of third party rights, merchantability, or
|
|---|
| 286 | ** fitness for any particular purpose. In no event will SOFA be
|
|---|
| 287 | ** liable to the user for any consequential, incidental, or special
|
|---|
| 288 | ** damages, including any lost profits or lost savings, even if a
|
|---|
| 289 | ** SOFA representative has been advised of such damages, or for any
|
|---|
| 290 | ** claim by any third party.
|
|---|
| 291 | **
|
|---|
| 292 | ** 6. The provision of any version of the SOFA software under the terms
|
|---|
| 293 | ** and conditions specified herein does not imply that future
|
|---|
| 294 | ** versions will also be made available under the same terms and
|
|---|
| 295 | ** conditions.
|
|---|
| 296 | *
|
|---|
| 297 | ** In any published work or commercial product which uses the SOFA
|
|---|
| 298 | ** software directly, acknowledgement (see www.iausofa.org) is
|
|---|
| 299 | ** appreciated.
|
|---|
| 300 | **
|
|---|
| 301 | ** Correspondence concerning SOFA software should be addressed as
|
|---|
| 302 | ** follows:
|
|---|
| 303 | **
|
|---|
| 304 | ** By email: sofa@ukho.gov.uk
|
|---|
| 305 | ** By post: IAU SOFA Center
|
|---|
| 306 | ** HM Nautical Almanac Office
|
|---|
| 307 | ** UK Hydrographic Office
|
|---|
| 308 | ** Admiralty Way, Taunton
|
|---|
| 309 | ** Somerset, TA1 2DN
|
|---|
| 310 | ** United Kingdom
|
|---|
| 311 | **
|
|---|
| 312 | **--------------------------------------------------------------------*/
|
|---|
| 313 | }
|
|---|