src/distribution/neukum.cpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // SPDX-License-Identifier: BSD-3-Clause | ||
| 2 | |||
| 3 | #include "terraingen/distribution/neukum.h" | ||
| 4 | |||
| 5 | #include "terraingen/distribution/power_law.h" | ||
| 6 | #include "terraingen/distribution/production_surface.h" | ||
| 7 | |||
| 8 | #include <cmath> | ||
| 9 | #include <memory> | ||
| 10 | #include <utility> | ||
| 11 | |||
| 12 | namespace terraingen { | ||
| 13 | |||
| 14 | namespace { | ||
| 15 | |||
| 16 | constexpr detail::ExponentialChronology kNeukum{5.44e-14, 6.93, 8.38e-4, kMaxLunarAgeGyr, | ||
| 17 | "Lunar surface age must be between 0 and 4.6 Gyr"}; | ||
| 18 | |||
| 19 | } // namespace | ||
| 20 | |||
| 21 | 7318730 | double NeukumLunarChronology(double ageGyr) { | |
| 22 | 7318730 | return kNeukum.Count(ageGyr); | |
| 23 | } | ||
| 24 | |||
| 25 | 12 | double NeukumLunarChronologyRate(double ageGyr) { | |
| 26 | 12 | return kNeukum.Rate(ageGyr); | |
| 27 | } | ||
| 28 | |||
| 29 | 765 | LogPolynomialSfd NeukumProductionFunction() { | |
| 30 | 765 | return LogPolynomialSfd({-3.076756, -3.557528, 0.781027, 1.021521, -0.156012, -0.444058, | |
| 31 | 0.019977, 0.086850, -0.005874, -0.006809, 8.25e-4, 5.54e-5}, | ||
| 32 | 765 | SfdKind::ProductionRate, DiameterRange{10.0, 300000.0}, 1000.0, 1e6); | |
| 33 | } | ||
| 34 | |||
| 35 | 730 | SplicedSfd ExtendedNeukumProductionFunction() { | |
| 36 | 730 | constexpr double kJoin = 10.0; | |
| 37 | 730 | constexpr double kSlope = 2.85; | |
| 38 | 1460 | auto npf = std::make_shared<LogPolynomialSfd>(NeukumProductionFunction()); | |
| 39 | 730 | const double coefficient = npf->Cumulative(kJoin) * std::pow(kJoin, kSlope); | |
| 40 | 730 | auto smallCraters = std::make_shared<PowerLawSfd>(coefficient, kSlope, SfdKind::ProductionRate); | |
| 41 | 2190 | return SplicedSfd({{2.5, std::move(smallCraters)}, {kJoin, std::move(npf)}}, 300000.0); | |
| 42 | 1460 | } | |
| 43 | |||
| 44 | } // namespace terraingen | ||
| 45 |