FireSTARR
Loading...
Searching...
No Matches
SimpleStandardFuel.h
1/* SPDX-License-Identifier: AGPL-3.0-or-later */
2#ifndef FS_SIMPLE_STANDARDFUEL
3#define FS_SIMPLE_STANDARDFUEL
4#include "stdafx.h"
5#include "LogValue.h"
6#include "LookupTable.h"
7#include "SimpleFuelType.h"
8namespace fs::simplefbp
9{
13static constexpr MathSize SLOPE_LIMIT_ISI = 0.01;
19[[nodiscard]] static MathSize calculate_standard_foliar_moisture_fmc(const MathSize fmc) noexcept
20{
21 return pow_int<4>(1.5 - 0.00275 * fmc) / (460.0 + 25.9 * fmc) / 0.778 * 1000.0;
22}
26static const LookupTable<&calculate_standard_foliar_moisture_fmc> STANDARD_FOLIAR_MOISTURE_FMC{};
33[[nodiscard]] static MathSize calculate_standard_foliar_moisture_isi(const MathSize isi) noexcept
34{
35 return 60.0 * (1.0 - exp(-0.0497 * isi));
36}
42static const LookupTable<&calculate_standard_foliar_moisture_isi> STANDARD_FOLIAR_MOISTURE_ISI{};
48[[nodiscard]] static MathSize calculate_standard_length_to_breadth(const MathSize ws) noexcept
49{
50 return 1.0 + 8.729 * pow(1.0 - exp(-0.030 * ws), 2.155);
51}
56static const LookupTable<&calculate_standard_length_to_breadth> STANDARD_LENGTH_TO_BREADTH{};
69template <
70 int A,
71 int B,
72 int C,
73 int Bui0,
74 int Cbh,
75 int Cfl,
76 int BulkDensity,
77 int InorganicPercent,
78 int DuffDepth>
79class SimpleStandardFuel : public SimpleFuelBase<BulkDensity, InorganicPercent, DuffDepth>
80{
81public:
92 const FuelCodeSize& code,
93 const char* name,
94 const bool can_crown,
95 const LogValue log_q,
96 const Duff* duff_ffmc,
97 const Duff* duff_dmc
98 ) noexcept
100 code,
101 name,
102 can_crown,
103 duff_ffmc,
104 duff_dmc
105 ),
106 log_q_(log_q)
107 { }
117 const FuelCodeSize& code,
118 const char* name,
119 const bool can_crown,
120 const LogValue log_q,
121 const Duff* duff
122 ) noexcept
123 : SimpleStandardFuel(code, name, can_crown, log_q, duff, duff)
124 { }
125 SimpleStandardFuel(SimpleStandardFuel&& rhs) noexcept = delete;
126 SimpleStandardFuel(const SimpleStandardFuel& rhs) noexcept = delete;
127 SimpleStandardFuel& operator=(SimpleStandardFuel&& rhs) noexcept = delete;
128 SimpleStandardFuel& operator=(const SimpleStandardFuel& rhs) = delete;
134 [[nodiscard]] MathSize rosBasic(const MathSize isi) const noexcept
135 {
136 return a() * pow(1.0 - exp(negB() * isi), c());
137 }
143 MathSize crownConsumption(const MathSize cfb) const noexcept override { return cfl() * cfb; }
150 [[nodiscard]] MathSize limitIsf(const MathSize mu, const MathSize rsf) const noexcept
151 {
152 return (1.0 / negB())
153 * log(
154 max(SLOPE_LIMIT_ISI, (rsf > 0.0) ? (1.0 - pow((rsf / (mu * a())), (1.0 / c()))) : 1.0)
155 );
156 }
162 [[nodiscard]] MathSize criticalSurfaceIntensity(const SpreadInfo& spread) const noexcept override
163 {
164 return 0.001 * pow(cbh(), 1.5) * pow(460.0 + 25.9 * spread.foliarMoisture(), 1.5);
165 }
171 [[nodiscard]] MathSize lengthToBreadth(const MathSize ws) const noexcept override
172 {
173 return STANDARD_LENGTH_TO_BREADTH(ws);
174 }
180 MathSize finalRos(const SpreadInfo&, MathSize, MathSize, const MathSize rss)
181 const noexcept override
182 {
183 return rss;
184 }
190 [[nodiscard]] MathSize buiEffect(const MathSize bui) const noexcept override
191 {
192 return (0 < bui) ? exp(50.0 * log_q_.value * ((1.0 / bui) - (1.0 / bui0()))) : 1.0;
193 }
194
195protected:
196 ~SimpleStandardFuel() override = default;
197
198public:
203 [[nodiscard]] static constexpr MathSize bui0() noexcept { return Bui0; }
208 [[nodiscard]] MathSize cbh() const override { return Cbh; }
213 [[nodiscard]] MathSize cfl() const override { return Cfl / 100.0; }
218 [[nodiscard]] static constexpr MathSize a() noexcept { return A; }
223 [[nodiscard]] static constexpr MathSize negB() noexcept
224 {
225 // the only places this gets used it gets negated so just store it that way
226 return -B / 10000.0;
227 }
232 [[nodiscard]] static constexpr MathSize c() noexcept { return C / 100.0; }
233
234public:
241 [[nodiscard]] static constexpr MathSize crownRateOfSpread(
242 const MathSize isi,
243 const MathSize fmc
244 ) noexcept
245 {
246 return STANDARD_FOLIAR_MOISTURE_ISI(isi) * STANDARD_FOLIAR_MOISTURE_FMC(fmc);
247 }
248 [[nodiscard]] constexpr MathSize logQ() const noexcept { return log_q_.value; }
249
250private:
255 static_assert(-negB() < 1);
256 static_assert(c() < 10 && c() > 1);
257};
258}
259#endif
constexpr FuelCodeSize code() const
Code for this fuel type.
Definition FuelType.h:212
constexpr const char * name() const
Name of the fuel.
Definition FuelType.h:207
Information regarding spread within a Cell for a specific Scenario and time.
Definition FireSpread.h:40
Base class for all FuelTypes.
Definition SimpleFuelType.h:17
constexpr SimpleFuelBase(const FuelCodeSize &code, const char *name, const bool can_crown, const Duff *duff_ffmc, const Duff *duff_dmc)
Constructor.
Definition SimpleFuelType.h:28
A SimpleFuelBase made of a standard fuel type.
Definition SimpleStandardFuel.h:80
static constexpr MathSize crownRateOfSpread(const MathSize isi, const MathSize fmc) noexcept
Crown fire spread rate (RSC) (m/min) [ST-X-3 eq 64].
Definition SimpleStandardFuel.h:241
MathSize cbh() const override
Crown base height (m) [ST-X-3 table 8].
Definition SimpleStandardFuel.h:208
LogValue log_q_
Log value of q [ST-X-3 table 7].
Definition SimpleStandardFuel.h:254
constexpr SimpleStandardFuel(const FuelCodeSize &code, const char *name, const bool can_crown, const LogValue log_q, const Duff *duff_ffmc, const Duff *duff_dmc) noexcept
Constructor.
Definition SimpleStandardFuel.h:91
MathSize finalRos(const SpreadInfo &, MathSize, MathSize, const MathSize rss) const noexcept override
Final rate of spread (m/min)
Definition SimpleStandardFuel.h:180
MathSize limitIsf(const MathSize mu, const MathSize rsf) const noexcept
ISI with slope influence and zero wind (ISF) [ST-X-3 eq 41].
Definition SimpleStandardFuel.h:150
MathSize crownConsumption(const MathSize cfb) const noexcept override
Crown Fuel Consumption (CFC) (kg/m^2) [ST-X-3 eq 66].
Definition SimpleStandardFuel.h:143
static constexpr MathSize bui0() noexcept
Average Build-up Index for the fuel type [ST-X-3 table 7].
Definition SimpleStandardFuel.h:203
static constexpr MathSize negB() noexcept
Negative of rate of spread parameter b [ST-X-3 table 6].
Definition SimpleStandardFuel.h:223
static constexpr MathSize c() noexcept
Rate of spread parameter c [ST-X-3 table 6].
Definition SimpleStandardFuel.h:232
MathSize cfl() const override
Crown fuel load (kg/m^2) [ST-X-3 table 8].
Definition SimpleStandardFuel.h:213
constexpr SimpleStandardFuel(const FuelCodeSize &code, const char *name, const bool can_crown, const LogValue log_q, const Duff *duff) noexcept
Constructor.
Definition SimpleStandardFuel.h:116
static constexpr MathSize a() noexcept
Rate of spread parameter a [ST-X-3 table 6].
Definition SimpleStandardFuel.h:218
MathSize lengthToBreadth(const MathSize ws) const noexcept override
Length to Breadth ratio [ST-X-3 eq 79].
Definition SimpleStandardFuel.h:171
MathSize criticalSurfaceIntensity(const SpreadInfo &spread) const noexcept override
Critical Surface Fire Intensity (CSI) [ST-X-3 eq 56].
Definition SimpleStandardFuel.h:162
MathSize buiEffect(const MathSize bui) const noexcept override
BUI Effect on surface fire rate of spread [ST-X-3 eq 54].
Definition SimpleStandardFuel.h:190
MathSize rosBasic(const MathSize isi) const noexcept
Initial rate of spread (m/min) [ST-X-3 eq 26].
Definition SimpleStandardFuel.h:134
A result of calling log(x) for some value of x, pre-calculated at compile time.
Definition LogValue.h:12
A specific type of Duff layer, and the associated smouldering coefficients.
Definition Duff.h:40