include/terraingen/layers/craters/ages/steady_state.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | |||
| 3 | /// @file | ||
| 4 | /// @brief Crater ages on surfaces where small craters are in equilibrium. | ||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "terraingen/distribution/production_surface.h" | ||
| 8 | #include "terraingen/distribution/size_frequency.h" | ||
| 9 | #include "terraingen/layers/craters/ages/age_model.h" | ||
| 10 | |||
| 11 | #include <memory> | ||
| 12 | |||
| 13 | namespace terraingen { | ||
| 14 | |||
| 15 | /// Ages of craters on a surface `ageGyr` old where small craters are in equilibrium. | ||
| 16 | /// | ||
| 17 | /// A crater's lifetime is tau(D) = n_eq(D) / n_prod(D), capped at the surface age; ages follow the | ||
| 18 | /// formation rate of `chronology` over [0, lifetime]. | ||
| 19 | class SteadyStateAges final : public CraterAgeModel { | ||
| 20 | public: | ||
| 21 | /// The ages on a surface `ageGyr` Gyr old. | ||
| 22 | /// @param productionRate A `ProductionRate` distribution. | ||
| 23 | /// @param equilibrium A `Density` distribution, such as `TraskEquilibrium`. | ||
| 24 | /// @param chronology N(>=1 km) per m^2 by age; ages are drawn in proportion to its rate. | ||
| 25 | /// @throws std::invalid_argument for null or mismatched kinds, or an empty `chronology`. | ||
| 26 | /// @throws std::domain_error if `chronology` rejects `ageGyr`. | ||
| 27 | SteadyStateAges(std::shared_ptr<const SizeFrequencyDistribution> productionRate, | ||
| 28 | std::shared_ptr<const SizeFrequencyDistribution> equilibrium, double ageGyr, | ||
| 29 | Chronology chronology); | ||
| 30 | |||
| 31 | /// The surface age in Gyr. | ||
| 32 | 7 | double SurfaceAgeGyr() const { | |
| 33 | 7 | return m_ageGyr; | |
| 34 | } | ||
| 35 | |||
| 36 | /// The equilibrium lifetime tau(D) in Gyr of craters of `diameter` meters, before capping at | ||
| 37 | /// the surface age. | ||
| 38 | /// @throws std::domain_error outside either distribution's valid range. | ||
| 39 | double EquilibriumLifetimeGyr(double diameter) const; | ||
| 40 | |||
| 41 | protected: | ||
| 42 | double LifetimeAt(double diameter) const override; | ||
| 43 | double SampleAgeAt(RandomStream& random, double diameter, double lifetimeGyr) const override; | ||
| 44 | |||
| 45 | private: | ||
| 46 | std::shared_ptr<const SizeFrequencyDistribution> m_productionRate; | ||
| 47 | std::shared_ptr<const SizeFrequencyDistribution> m_equilibrium; | ||
| 48 | double m_ageGyr; | ||
| 49 | Chronology m_chronology; | ||
| 50 | }; | ||
| 51 | |||
| 52 | /// A surface `ageGyr` old by `chronology`, cratered by `production` and capped by the | ||
| 53 | /// `equilibrium` density: its crater density and steady-state ages from the one set of models, so | ||
| 54 | /// they cannot disagree. | ||
| 55 | struct EquilibriumSurface { | ||
| 56 | /// A `ProductionRate` distribution, such as `ExtendedNeukumProductionFunction`. | ||
| 57 | std::shared_ptr<const SizeFrequencyDistribution> production; | ||
| 58 | /// A `Density` distribution, such as `HartmannEquilibrium`. | ||
| 59 | std::shared_ptr<const SizeFrequencyDistribution> equilibrium; | ||
| 60 | double ageGyr = 3.5; ///< Surface age in Gyr. | ||
| 61 | Chronology chronology; ///< N(>=1 km) per m^2 by age, such as `NeukumLunarChronology`. | ||
| 62 | |||
| 63 | /// The least of the production surface (`ProductionSurface`) and the equilibrium | ||
| 64 | /// (`MinimumSfd`), craters per m^2 by diameter. | ||
| 65 | /// @throws std::invalid_argument as `ProductionSurface` and `MinimumSfd`. | ||
| 66 | std::shared_ptr<const SizeFrequencyDistribution> Density() const; | ||
| 67 | |||
| 68 | /// The steady-state ages on the surface (`SteadyStateAges`). | ||
| 69 | /// @throws std::invalid_argument as `SteadyStateAges`. | ||
| 70 | std::shared_ptr<const SteadyStateAges> Ages() const; | ||
| 71 | }; | ||
| 72 | |||
| 73 | } // namespace terraingen | ||
| 74 |