00001
00002 c Definitions to allow FORTRAN programs to use Starlab scatter3.
00003
00004 implicit real*8 (a-h, o-z)
00005
00006 parameter (VERY_LARGE_NUMBER = 1.e30,
00007 $ PI = 3.14159265358979323846)
00008
00009 c Structures defining the initial, intermediate, and final states of a
00010 c single scattering:
00011
00012 c Initial state structure:
00013
00014 real*8 m2 ! mass of secondary in target binary (m1+m2=1)
00015 real*8 m3 ! mass of incoming projectile
00016 real*8 r1 ! radius of primary
00017 real*8 r2 ! radius of secondary
00018 real*8 r3 ! radius of third star
00019 real*8 init_sma ! inner binary semi-major axis
00020 real*8 init_ecc ! inner binary eccentricity
00021 real*8 v_inf ! projectile velocity at infinity (v_crit)
00022 real*8 rho ! projectile impact parameter
00023 real*8 r_init_min ! min initial distance projectile to target
00024 real*8 r_init_max ! max initial distance projectile to target
00025 real*8 r_init ! actual initial separation
00026 real*8 r_stop ! max permitted distance escaper to binary
00027 real*8 tidal_tol ! tidal perturbation at start/stop
00028 real*8 phase(4) ! phase angles specifying the initial state:
00029 ! cos_theta, phi, psi, mean_anomaly
00030 real*8 eta ! accuracy parameter
00031
00032 c This is really inelegant, but it is most convenient for the
00033 c interface routines to assume that the FORTRAN common blocks are
00034 c precisely equivalent to the corresponding C/C++ structures.
00035 c In particular, while it would probably (certainly) be better
00036 c for the "system" parameters below to be expressed as arrays of
00037 c indices, mass, etc., the Starlab software treats them as arrays
00038 c of structures. We could try to remap between the FORTRAN and
00039 c and C(++) descriptions using "memcpy," but the alignment of data
00040 c in memory is important. Since there is no way to know in advance
00041 c the conventions used on any given machine, we take the simplest
00042 c way out and mimic the C structure here. Placing the indices at
00043 c the end of the structure here (and in scatter3.h) should make
00044 c things work right on machines that like to align real*8 and
00045 c larger structures on 8-byte boundaries.
00046
00047 c This is what you get for insisting on FORTRAN in the 1990s!
00048 c (Of course, we could use FORTRAN-90...)
00049
00050 real*8 init_mass1, init_mass2, init_mass3
00051 real*8 init_pos1(3), init_pos2(3), init_pos3(3)
00052 real*8 init_vel1(3), init_vel2(3), init_vel3(3)
00053 integer init_index1, init_index2, init_index3
00054
00055 common /init/ m2, m3, r1, r2, r3, init_sma, init_ecc,
00056 $ v_inf, rho, r_init_min, r_init_max, r_init,
00057 $ r_stop, tidal_tol, phase, eta,
00058 $ init_mass1, init_pos1, init_vel1, init_index1,
00059 $ init_mass2, init_pos2, init_vel2, init_index2,
00060 $ init_mass3, init_pos3, init_vel3, init_index3
00061
00062 c Intermediate state structure:
00063
00064 integer n_osc ! number of "oscillations" in min(r)
00065 integer n_kepler ! number of analytic continuations
00066 integer n_stars ! final number of stars
00067 integer index(3) ! final labels
00068 real*8 r_min(3) ! minimum interparticle separations
00069 real*8 r_min_min ! absolute minimum separation
00070 integer inter_descr ! intermediate descriptor
00071
00072 c (Same comments as above.)
00073
00074 real*8 inter_mass1, inter_mass2, inter_mass3
00075 real*8 inter_pos1(3), inter_pos2(3), inter_pos3(3)
00076 real*8 inter_vel1(3), inter_vel2(3), inter_vel3(3)
00077 integer inter_index1, inter_index2, inter_index3
00078
00079 common /inter/ n_osc, n_kepler, n_stars, index,
00080 $ r_min, r_min_min, inter_descr,
00081 $ inter_mass1, inter_pos1,
00082 $ inter_vel1, inter_index1,
00083 $ inter_mass2, inter_pos2,
00084 $ inter_vel2, inter_index2,
00085 $ inter_mass3, inter_pos3,
00086 $ inter_vel3, inter_index3
00087
00088 c Final state structure:
00089
00090 real*8 final_sma ! final binary semi-major axis
00091 real*8 final_ecc ! final binary eccentricity
00092 real*8 outer_sep ! final separation between third star
00093 ! and binary (if any)
00094 integer final_descr ! final descriptor
00095 integer escaper ! ID of escaping star (0 if none exists)
00096 real*8 error ! rel. energy error (unit=binary energy)
00097 real*8 time ! termination time
00098 integer n_steps ! number of integration steps
00099 real*8 virial_ratio ! final ratio K.E./|P.E.| of outer orbit
00100
00101 c (Same comments as above.)
00102
00103 real*8 final_mass1, final_mass2, final_mass3
00104 real*8 final_pos1(3), final_pos2(3), final_pos3(3)
00105 real*8 final_vel1(3), final_vel2(3), final_vel3(3)
00106 integer final_index1, final_index2, final_index3
00107
00108 common /final/ final_sma, final_ecc, outer_sep, final_descr,
00109 $ escaper, error, time, n_steps, virial_ratio,
00110 $ final_mass1, final_pos1,
00111 $ final_vel1, final_index1,
00112 $ final_mass2, final_pos2,
00113 $ final_vel2, final_index2,
00114 $ final_mass3, final_pos3,
00115 $ final_vel3, final_index3