Another attempt at a clone based on Aurora

terrestrial_body.moon 1.9KB

1234567891011121314151617181920212223242526272829
  1. -- TODO defined globals need to be created somewhere else
  2. export gravitational_constant = 6.6743e-11 -- m^3 / (kg * s^2)
  3. export magic_pressure_constant = 1.1701572e-4 -- s^2 / m^2
  4. parameters = {
  5. surface_radius: love.math.randomNormal 1100, 5500 -- [1.1e3, 9.9e3 km]
  6. solid_density: love.math.randomNormal 0.675, 5.2 -- [2.5, 7.9 g/cm^3]
  7. }
  8. parameters.solid_volume = 4/3 * math.pi * parameters.surface_radius^3 -- km^3
  9. parameters.solid_mass = parameters.solid_density * parameters.solid_volume * 1e12 -- kg
  10. parameters.surface_gravity = gravitational_constant * parameters.solid_mass / parameters.surface_radius^2 * 1e-6 -- m/s^2
  11. parameters.atmosphere_reduction_rate = parameters.surface_gravity * magic_pressure_constant -- m^-1
  12. parameters.atmosphere_halving_height = math.log(2) / parameters.atmosphere_reduction_rate -- m
  13. -- volume containing the first half of the entire atmosphere is assumed to be
  14. -- half of the volume of the entire atmosphere if it was at surface pressure
  15. parameters.simulated_atmosphere_volume = (4/3 * math.pi * (parameters.surface_radius + parameters.atmosphere_halving_height / 1000)^3 - parameters.solid_volume) * 2 -- km^3
  16. -- TODO better (based on distance from star / temperature from star)
  17. parameters.surface_atmosphere_pressure = 101325 * math.max 0, love.math.randomNormal 0.125, 0.5 -- [0, 202650 kPa]
  18. -- TODO verify this will generate in meters
  19. parameters.minimum_orbital_height = math.log(1.4e-11 / parameters.surface_atmosphere_pressure) / parameters.atmosphere_reduction_rate -- m
  20. parameters.atmosphere_volume = 4/3 * math.pi * (parameters.surface_radius + parameters.minimum_orbital_height / 1000)^3 - parameters.solid_volume -- km^3
  21. -- TODO atmospheric composition?
  22. -- TODO albedo
  23. -- TODO surface_average_temperature (based on greenhouse gases or lack thereof, albedo, and base temperature from distance to star)
  24. -- unused at this time?
  25. parameters.surface_area = 4 * math.pi * parameters.surface_radius^2