00001
00002 program fscat_template
00003
00004 c Template F77 program using scatter3.
00005
00006 c The "states" defining initial, intermediate, and final
00007 c configurations of the system are defined in f_scatter3.h.
00008
00009 c The "f_" and "c_" routines are FORTRAN-callable links to
00010 c Starlab C++ functions.
00011
00012 include 'f_scatter3.h'
00013 include 'f_interface.h'
00014
00015 iseed = 0 ! Seed for random number generator
00016 ! (0 ==> system chooses number)
00017 n_rand = 0 ! Number of times to invoke generator
00018 ! before starting "for real"
00019
00020 cpu_time_check = 3600 ! Interval for checking CPU time (sec)
00021 dt_out = VERY_LARGE_NUMBER ! Output time interval
00022 dt_snap = VERY_LARGE_NUMBER ! Snapshot time interval
00023 snap_cube_size = 10 ! Size of cube for snapshot output
00024
00025 c Note: all operations modify the /init/, /inter/, and /final/
00026 c common arrays (which are kept conveniently hidden from view).
00027
00028 c Initialization:
00029
00030 call f_srandinter(iseed, n_rand)
00031 call f_make_standard_init()
00032 call f_initialize_angles(0, 0, 0.0d0) ! Some FORTRANs insist on the "d0"
00033
00034 c e.g:
00035
00036 mean_anomaly = f_randinter(0.0d0, 2*PI)
00037 v_inf = 0.1
00038
00039 c Perform the scattering calculation.
00040
00041 call f_cpu_init()
00042 call f_scatter3(cpu_time_check, dt_out, dt_snap, snap_cube_size)
00043
00044 c Print all available information on the initial state.
00045
00046 write(6,'(''Initial state:'')')
00047 write(6,'('' m1 = '',f10.6)')1-m2 ! convention: m1 + m2 = 1
00048 write(6,'('' m2 = '',f10.6)')m2
00049 write(6,'('' m3 = '',f10.6)')m3
00050 write(6,'('' r1 = '',f10.6)')r1
00051 write(6,'('' r2 = '',f10.6)')r2
00052 write(6,'('' r3 = '',f10.6)')r3
00053 write(6,'('' sma = '',f10.6)')init_sma
00054 write(6,'('' ecc = '',f10.6)')init_ecc
00055 write(6,'('' v_inf = '',f10.6)')v_inf
00056 write(6,'('' rho = '',f10.6)')rho
00057 write(6,'('' r_init_min = '',f10.6)')r_init_min
00058 write(6,'('' r_init_max = '',1p,e14.6)')r_init_max
00059 write(6,'('' r_init = '',f10.6)')r_init
00060 write(6,'('' r_stop = '',1p,e14.6)')r_stop
00061 write(6,'('' tidal_tol = '',1p,e14.6)')tidal_tol
00062 write(6,'('' eta = '',f10.6)')eta
00063 write(6,'('' phase:'')')
00064 write(6,'('' cos_theta = '',f10.6)')phase(1)
00065 write(6,'('' phi = '',f10.6)')phase(2)
00066 write(6,'('' psi = '',f10.6)')phase(3)
00067 write(6,'('' mean_anomaly = '',f10.6)')phase(4)
00068 call print_system(
00069 $ init_index1, init_mass1, init_pos1, init_vel1,
00070 $ init_index2, init_mass2, init_pos2, init_vel2,
00071 $ init_index3, init_mass3, init_pos3, init_vel3)
00072
00073 c Print all available information on the intermediate state.
00074
00075 write(6,'(/''Intermediate state:'')')
00076 write(6,'('' n_osc = '',i6)')n_osc
00077 write(6,'('' n_kepler = '',i6)')n_kepler
00078 write(6,'('' n_stars = '',i6)')n_stars
00079 write(6,'('' index = '',3i3)')(index(k),k=1,3)
00080 write(6,'('' r_min = '',1p,3e14.6)')(r_min(k),k=1,3)
00081 write(6,'('' r_min_min = '',1p,e14.6)')r_min_min
00082 call f_print_intermediate_descriptor(inter_descr)
00083 call print_system(
00084 $ inter_index1, inter_mass1, inter_pos1, inter_vel1,
00085 $ inter_index2, inter_mass2, inter_pos2, inter_vel2,
00086 $ inter_index3, inter_mass3, inter_pos3, inter_vel3)
00087
00088 c Print all available information on the final state.
00089
00090 write(6,'(/''Final state:'')')
00091 write(6,'('' sma = '',f10.6)')final_sma
00092 write(6,'('' ecc = '',f10.6)')final_ecc
00093 write(6,'('' outer_separation = '',1p,e14.6)')outer_sep
00094 write(6,'('' escaper = '',i10)')escaper
00095 write(6,'('' error = '',f10.6)')error
00096 write(6,'('' time = '',1p,e14.6)')time
00097 write(6,'('' n_steps = '',i10)')n_steps
00098 write(6,'('' virial_ratio = '',f10.6)')virial_ratio
00099 call f_print_final_descriptor(final_descr)
00100 call print_system(
00101 $ final_index1, final_mass1, final_pos1, final_vel1,
00102 $ final_index2, final_mass2, final_pos2, final_vel2,
00103 $ final_index3, final_mass3, final_pos3, final_vel3)
00104
00105 write(6,'(/''CPU time = '',f10.6)')f_cpu_time()
00106
00107 end
00108
00109
00110 subroutine print_system(index1, mass1, pos1, vel1,
00111 $ index2, mass2, pos2, vel2,
00112 $ index3, mass3, pos3, vel3)
00113
00114 integer index1, index2, index3
00115 real*8 mass1, mass2, mass3
00116 real*8 pos1(3),pos2(3),pos3(3)
00117 real*8 vel1(3),vel2(3),vel3(3)
00118
00119 write(6,'('' system:'')')
00120
00121 call print_particle(1, index1, mass1, pos1, vel1)
00122 call print_particle(2, index2, mass2, pos2, vel2)
00123 call print_particle(3, index3, mass3, pos3, vel3)
00124
00125 end
00126
00127
00128 subroutine print_particle(i, index, mass, pos, vel)
00129 integer i, index
00130 real*8 mass, pos(3), vel(3)
00131
00132 write(6,'('' '',i3,'' ('',i3,'') mass:'',f14.6)')
00133 $ i, index, mass
00134 write(6,'('' pos: '',3f14.6)')(pos(k),k=1,3)
00135 write(6,'('' vel: '',3f14.6)')(vel(k),k=1,3)
00136
00137 end