distribution/neukum.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "terraingen/distribution/neukum.h" | ||
| 2 | |||
| 3 | #include "terraingen/distribution/power_law.h" | ||
| 4 | |||
| 5 | #include <cmath> | ||
| 6 | #include <memory> | ||
| 7 | #include <stdexcept> | ||
| 8 | #include <utility> | ||
| 9 | |||
| 10 | namespace terraingen { | ||
| 11 | |||
| 12 | namespace { | ||
| 13 | |||
| 14 | 40047887 | void CheckAge(double ageGyr) { | |
| 15 | 40047887 | if (!(ageGyr >= 0.0 && ageGyr <= kMaxLunarAgeGyr)) { | |
| 16 | 12 | throw std::domain_error("Lunar surface age must be between 0 and 4.6 Gyr"); | |
| 17 | } | ||
| 18 | 40047875 | } | |
| 19 | |||
| 20 | } // namespace | ||
| 21 | |||
| 22 | 40047879 | double NeukumLunarChronology(double ageGyr) { | |
| 23 | 40047879 | CheckAge(ageGyr); | |
| 24 | 40047869 | return (5.44e-14 * std::expm1(6.93 * ageGyr) + 8.38e-4 * ageGyr) / 1e6; | |
| 25 | } | ||
| 26 | |||
| 27 | 8 | double NeukumLunarChronologyRate(double ageGyr) { | |
| 28 | 8 | CheckAge(ageGyr); | |
| 29 | 6 | return (5.44e-14 * 6.93 * std::exp(6.93 * ageGyr) + 8.38e-4) / 1e6; | |
| 30 | } | ||
| 31 | |||
| 32 | 775 | LogPolynomialSfd NeukumProductionFunction() { | |
| 33 | return LogPolynomialSfd({-3.076756, -3.557528, 0.781027, 1.021521, -0.156012, -0.444058, | ||
| 34 | 0.019977, 0.086850, -0.005874, -0.006809, 8.25e-4, 5.54e-5}, | ||
| 35 | 2325 | DiameterRange{10.0, 300000.0}, SfdKind::ProductionRate, 1000.0, 1e6); | |
| 36 | } | ||
| 37 | |||
| 38 | 748 | SplicedSfd ExtendedNeukumProductionFunction() { | |
| 39 | 748 | constexpr double kJoin = 10.0; | |
| 40 | 748 | constexpr double kSlope = 2.85; | |
| 41 | 748 | auto npf = std::make_shared<LogPolynomialSfd>(NeukumProductionFunction()); | |
| 42 | 748 | const double coefficient = npf->Cumulative(kJoin) * std::pow(kJoin, kSlope); | |
| 43 | 748 | auto smallCraters = std::make_shared<PowerLawSfd>(coefficient, kSlope, SfdKind::ProductionRate); | |
| 44 | 1496 | return SplicedSfd({{2.5, std::move(smallCraters)}, {kJoin, std::move(npf)}}, | |
| 45 | 3740 | DiameterRange{2.5, 300000.0}); | |
| 46 | 1496 | } | |
| 47 | |||
| 48 | } // namespace terraingen | ||
| 49 |