| 1 | /* | 
|---|
| 2 | *+ | 
|---|
| 3 | *  Name: | 
|---|
| 4 | *     pal1Atms | 
|---|
| 5 |  | 
|---|
| 6 | *  Purpose: | 
|---|
| 7 | *     Calculate stratosphere parameters | 
|---|
| 8 |  | 
|---|
| 9 | *  Language: | 
|---|
| 10 | *     Starlink ANSI C | 
|---|
| 11 |  | 
|---|
| 12 | *  Type of Module: | 
|---|
| 13 | *     Library routine | 
|---|
| 14 |  | 
|---|
| 15 | *  Invocation: | 
|---|
| 16 | *     void pal1Atms ( double rt, double tt, double dnt, double gamal, | 
|---|
| 17 | *                     double r, double * dn, double * rdndr ); | 
|---|
| 18 |  | 
|---|
| 19 | *  Arguments: | 
|---|
| 20 | *     rt = double (Given) | 
|---|
| 21 | *         Height of the tropopause from centre of the Earth (metre) | 
|---|
| 22 | *     tt = double (Given) | 
|---|
| 23 | *         Temperature at the tropopause (K) | 
|---|
| 24 | *     dnt = double (Given) | 
|---|
| 25 | *         Refractive index at the tropopause | 
|---|
| 26 | *     gamal = double (Given) | 
|---|
| 27 | *         Constant of the atmospheric model = G*MD/R | 
|---|
| 28 | *     r = double (Given) | 
|---|
| 29 | *         Current distance from the centre of the Earth (metre) | 
|---|
| 30 | *     dn = double * (Returned) | 
|---|
| 31 | *         Refractive index at r | 
|---|
| 32 | *     rdndr = double * (Returned) | 
|---|
| 33 | *         r * rate the refractive index is changing at r | 
|---|
| 34 |  | 
|---|
| 35 | *  Description: | 
|---|
| 36 | *     Refractive index and derivative with respect to height for the | 
|---|
| 37 | *     stratosphere. | 
|---|
| 38 |  | 
|---|
| 39 | *  Authors: | 
|---|
| 40 | *     TIMJ: Tim Jenness (JAC, Hawaii) | 
|---|
| 41 | *     PTW: Patrick T. Wallace | 
|---|
| 42 | *     {enter_new_authors_here} | 
|---|
| 43 |  | 
|---|
| 44 | *  Notes: | 
|---|
| 45 | *     - Internal routine used by palRefro. | 
|---|
| 46 |  | 
|---|
| 47 | *  History: | 
|---|
| 48 | *     2012-08-24 (TIMJ): | 
|---|
| 49 | *        Initial version | 
|---|
| 50 | *        Adapted with permission from the Fortran SLALIB library. | 
|---|
| 51 | *     {enter_further_changes_here} | 
|---|
| 52 |  | 
|---|
| 53 | *  Copyright: | 
|---|
| 54 | *     Copyright (C) 2004 Patrick T. Wallace | 
|---|
| 55 | *     Copyright (C) 2012 Science and Technology Facilities Council. | 
|---|
| 56 | *     All Rights Reserved. | 
|---|
| 57 |  | 
|---|
| 58 | *  Licence: | 
|---|
| 59 | *     This program is free software; you can redistribute it and/or | 
|---|
| 60 | *     modify it under the terms of the GNU General Public License as | 
|---|
| 61 | *     published by the Free Software Foundation; either version 3 of | 
|---|
| 62 | *     the License, or (at your option) any later version. | 
|---|
| 63 | * | 
|---|
| 64 | *     This program is distributed in the hope that it will be | 
|---|
| 65 | *     useful, but WITHOUT ANY WARRANTY; without even the implied | 
|---|
| 66 | *     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | 
|---|
| 67 | *     PURPOSE. See the GNU General Public License for more details. | 
|---|
| 68 | * | 
|---|
| 69 | *     You should have received a copy of the GNU General Public License | 
|---|
| 70 | *     along with this program; if not, write to the Free Software | 
|---|
| 71 | *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 
|---|
| 72 | *     MA 02110-1301, USA. | 
|---|
| 73 |  | 
|---|
| 74 | *  Bugs: | 
|---|
| 75 | *     {note_any_bugs_here} | 
|---|
| 76 | *- | 
|---|
| 77 | */ | 
|---|
| 78 |  | 
|---|
| 79 | #include <math.h> | 
|---|
| 80 |  | 
|---|
| 81 | #include "pal1.h" | 
|---|
| 82 |  | 
|---|
| 83 | void pal1Atms ( double rt, double tt, double dnt, double gamal, | 
|---|
| 84 | double r, double * dn, double * rdndr ) { | 
|---|
| 85 |  | 
|---|
| 86 | double b; | 
|---|
| 87 | double w; | 
|---|
| 88 |  | 
|---|
| 89 | b = gamal / tt; | 
|---|
| 90 | w = (dnt - 1.0) * exp( -b * (r-rt) ); | 
|---|
| 91 | *dn = 1.0 + w; | 
|---|
| 92 | *rdndr = -r * b * w; | 
|---|
| 93 |  | 
|---|
| 94 | } | 
|---|
| 95 |  | 
|---|