home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / misc / sci / accrete / src / display.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-12  |  3.0 KB  |  73 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <math.h>
  4. #include <stddef.h>
  5. #include <stdlib.h>
  6. #ifdef AMIGA
  7. #ifdef HUGE_VAL
  8. #undef HUGE_VAL
  9. #endif /* HUGE_VAL */
  10. #endif /* AMIGA */
  11. #include <float.h>
  12. #include <time.h>
  13.  
  14. #include "const.h"
  15. #include "structs.h"
  16. #include "accrete.h"
  17.  
  18. void display_system()
  19. {
  20.      planet_pointer node1; 
  21.      int counter; 
  22.      char word[(10)+1]; 
  23.  
  24.      FILE *f;
  25.      f = fopen("New.System", "w");
  26.  
  27.      fprintf(f,"                         SYSTEM  CHARACTERISTICS\n");
  28.      fprintf(f,"Mass of central star (in solar masses): %4.2lf\n", stellar_mass_ratio);
  29.      fprintf(f,"Luminosity of central star (relative to the sun): %5.2lf\n",stellar_luminosity_ratio);
  30.      fprintf(f,"Total main sequence lifetime (in million yrs): %10.3lf\n", (main_seq_life / 1.0E6));
  31.      fprintf(f,"Current age of stellar system (in million yrs): %10.3lf\n",(age / 1.0E6));
  32.      fprintf(f,"Radius of habitable ecosphere (AU): %3.3lf\n",r_ecosphere);
  33.      node1 = planet_head;
  34.      counter = 1;
  35.      while (node1 != NULL)
  36.      {
  37.       fprintf(f,"Planet #%d:\n",counter);
  38.       if (node1->gas_giant)
  39.            fprintf(f,"Gas giant...\n");
  40.       if (node1->resonant_period)
  41.            fprintf(f,"In resonant period with primary.\n");
  42.       fprintf(f,"   Distance from primary star (in A.U.): %7.3lf\n",node1->a);
  43.       fprintf(f,"   Eccentricity of orbit: %5.3lf\n",node1->e);
  44.       fprintf(f,"   Mass (in Earth masses): %7.3lf\n",node1->mass * EARTH_MASSES_PER_SOLAR_MASS);
  45.       fprintf(f,"   Equatorial radius (in Km): %10.1lf\n",node1->radius);
  46.       fprintf(f,"   Density (in g/cc): %6.3lf\n",node1->density);
  47.       fprintf(f,"   Escape Velocity (in km/sec): %5.2lf\n",node1->escape_velocity / CM_PER_KM);
  48.       fprintf(f,"   Smallest molecular weight retained: %5.2lf\n",node1->molecule_weight);
  49.       fprintf(f,"   Surface acceleration (in cm/sec2): %6.2lf\n",node1->surface_accel);
  50.       if (!(node1->gas_giant))
  51.       {
  52.            fprintf(f,"   Surface Gravity (in Earth gees): %5.2lf\n",node1->surface_grav);
  53.            fprintf(f,"   Boiling point of water (celcius): %4.1lf\n",(node1->boil_point - KELVIN_CELCIUS_DIFFERENCE));
  54.            fprintf(f,"   Surface Pressure (in atmospheres): %5.3lf",(node1->surface_pressure / 1000.0));
  55.            if ((node1->greenhouse_effect) && (node1->surface_pressure > 0.0))
  56.             fprintf(f,"     RUNAWAY GREENHOUSE EFFECT\n");
  57.            else 
  58.             fprintf(f,"\n");
  59.            fprintf(f,"   Surface temperature (Celcius): %4.2lf\n",(node1->surface_temp - KELVIN_CELCIUS_DIFFERENCE));
  60.            fprintf(f,"   Hydrosphere percentage: %6.2lf\n",(node1->hydrosphere * 100.0));
  61.            fprintf(f,"   Cloud cover percentage: %6.2lf\n",(node1->cloud_cover * 100));
  62.            fprintf(f,"   Ice cover percentage: %6.2lf\n",(node1->ice_cover * 100));
  63.       }
  64.       fprintf(f,"   Axial tilt (in degrees): %d\n",node1->axial_tilt);
  65.       fprintf(f,"   Planetary albedo: %4.3lf\n",node1->albedo);
  66.       fprintf(f,"   Length of year (in days): %7.2lf\n",node1->orbital_period);
  67.       fprintf(f,"   Length of day (in hours): %7.2lf\n",node1->day);
  68.       counter++;
  69.       node1 = node1->next_planet;
  70.      }
  71.         fclose(f);
  72. }
  73.