feat(simulation): planet_class temperature envelope, drop orbit/star inputs (T-1033, D-240)
Replace the sun-driven Stefan-Boltzmann temperature with the D-240 class-envelope model. Temperature derives only from authored fields — no orbit/star physics. - [planet_class_temperature] envelope table in climate_constants.toml (approved bands: frozen [-90,-25] .. hot_arid [20,58] .. volcanic [30,90]); cold_/hot_/ warm_ prefix parsing; temperate fallback for unknowns. - derive_temperature_c(params, constants, body_seed): band = envelope(planet_class); latitude lerps across it (equator=warm, pole=cold); atmosphere greenhouse + elevation lapse modulate within; small seed nudge for per-body variety; CLAMP to band — a body can never escape its class. Airless -> None. - Delete the dead astrophysics: derive_distance_au, ClimateConstants::luminosity(), the [star_luminosity] table. Strip orbital_period_days/spectral_class/star_type/ axial_tilt_deg from BodyParams + BodyParamsReader (read 3 cols from bodies, no star_systems join). DB columns left in place (no regen). - New every_planet_class_derives_within_its_band test (13 classes x 5 atmo x 19 lat x 4 seeds, all in band) — the D-240 consistency guard. Verified on 25 diverse real bodies: the worlds that derived to +356C now sit inside their class bands (temperate capped at 28C). cargo test passes, clippy -D warnings clean, fmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,30 +1,56 @@
|
||||
# Climate constants for district temperature derivation (T-1024, D-239 §2).
|
||||
# Climate constants for district temperature derivation (T-1024, D-239 §2, D-240).
|
||||
#
|
||||
# Source-canonical — loaded by the Rust simulation at runtime.
|
||||
# These values mirror the tuned constants from tooling/planet-gen/planet_simulation.py.
|
||||
# Changing these constants does NOT require a DB migration (runtime file, not DB).
|
||||
# To tune: edit here, rerun the server, inspect Atlas temperature maps.
|
||||
#
|
||||
# Two tables are required:
|
||||
# [greenhouse_offset_c] — mean-annual base temperature offset by atmosphere class.
|
||||
# [diurnal_amplitude_c] — day/night swing AMPLITUDE by atmosphere class.
|
||||
# Three tables are required:
|
||||
# [planet_class_temperature] — per-class [cold_end, warm_end] °C band (D-240).
|
||||
# [greenhouse_offset_c] — mean-annual base temperature offset by atmosphere class.
|
||||
# [diurnal_amplitude_c] — day/night swing AMPLITUDE by atmosphere class.
|
||||
#
|
||||
# Temperature derivation formula (D-239 §2):
|
||||
# T_base = T_stellar_equilibrium + greenhouse_offset_c[atmosphere]
|
||||
# T_mean = T_base + latitude_term + elevation_lapse_term
|
||||
# T_diurnal_amplitude = diurnal_amplitude_c[atmosphere]
|
||||
# Temperature derivation formula (D-240):
|
||||
# (cold, warm) = planet_class_temperature[planet_class] # envelope
|
||||
# t_lat = warm - (warm - cold) * (|latitude_deg| / 90) # latitude lerp
|
||||
# greenhouse modulates within the band
|
||||
# elevation lapse pulls toward cold end
|
||||
# seed nudge ±~3°C
|
||||
# CLAMP to [cold, warm] — body can never derive outside its class band.
|
||||
#
|
||||
# No atmosphere → temperature_c = None (airless body; D-227).
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Planet class temperature envelopes (D-240).
|
||||
# Each entry: [cold_end_c, warm_end_c] — the band a body of this class stays in.
|
||||
# Prefix rules: "cold_*" shifts both ends ~10°C colder; "hot_*" ~10°C warmer;
|
||||
# "warm_*" ~5°C warmer. Unknown class falls back to "temperate" band.
|
||||
# ---------------------------------------------------------------------------
|
||||
[planet_class_temperature]
|
||||
frozen = [-90.0, -25.0]
|
||||
ice = [-90.0, -25.0]
|
||||
boreal = [-35.0, 12.0]
|
||||
cold_arid = [-40.0, 20.0]
|
||||
temperate = [-12.0, 28.0]
|
||||
oceanic = [-12.0, 28.0]
|
||||
subtropical = [ 2.0, 34.0]
|
||||
warm_ocean = [ 2.0, 34.0]
|
||||
tropical = [ 16.0, 40.0]
|
||||
arid = [ -5.0, 45.0]
|
||||
hot_arid = [ 20.0, 58.0]
|
||||
volcanic = [ 30.0, 90.0]
|
||||
geothermal = [ 30.0, 90.0]
|
||||
|
||||
[greenhouse_offset_c]
|
||||
# Greenhouse warming contribution per atmosphere class (°C above bare rock).
|
||||
# Greenhouse warming contribution per atmosphere class — used as a fractional
|
||||
# nudge toward the warm end of the class band, not an absolute Kelvin offset.
|
||||
# "none" is not present — airless bodies skip the climate branch entirely (D-227).
|
||||
# Values from planet_simulation.py STAR_LUMINOSITY + greenhouse table.
|
||||
thin = 8
|
||||
standard = 33
|
||||
toxic = 33 # treated as standard greenhouse for thermal purposes
|
||||
breathable = 33 # synonym for standard
|
||||
dense = 80
|
||||
# Values represent a 0.0–1.0 fraction of the band width to add toward warm end.
|
||||
# thin=0.1 (slightly warmer), breathable/standard=0.25, toxic=0.25, dense=0.55
|
||||
thin = 0.10
|
||||
standard = 0.25
|
||||
toxic = 0.25
|
||||
breathable = 0.25
|
||||
dense = 0.55
|
||||
|
||||
[diurnal_amplitude_c]
|
||||
# Day/night swing amplitude (°C). The actual swing is ±amplitude around the
|
||||
@@ -39,20 +65,3 @@ standard = 15 # ~15°C: Earth-like moderate swing
|
||||
toxic = 20 # intermediate: thick but maybe less redistribution
|
||||
breathable = 15 # synonym for standard
|
||||
dense = 3 # ~3°C: Venus-like near-uniform temperature
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Stellar luminosity lookup (relative to Sol = 1.0).
|
||||
# Midpoint per spectral type, matching planet_simulation.py STAR_LUMINOSITY.
|
||||
# Used to derive distance_au at runtime from orbital_period_days via Kepler's 3rd law.
|
||||
#
|
||||
# These values are also used to compute T_stellar_equilibrium:
|
||||
# T_eq_K = 278.5 * (luminosity ^ 0.25) / sqrt(distance_au)
|
||||
# ---------------------------------------------------------------------------
|
||||
[star_luminosity]
|
||||
O = 100000.0
|
||||
B = 1000.0
|
||||
A = 10.0
|
||||
F = 2.5
|
||||
G = 1.0
|
||||
K = 0.4
|
||||
M = 0.04
|
||||
|
||||
Reference in New Issue
Block a user