23constexpr FuelCodeSize INVALID_FUEL_CODE = 0;
38static constexpr MathSize DEFAULT_GRASS_FUEL_LOAD = 0.35;
40static constexpr MathSize DUFF_FFMC_DEPTH = 1.2;
47[[nodiscard]]
constexpr MathSize fire_intensity(
const MathSize fc,
const MathSize ros)
49 return 300.0 * fc * ros;
64 return nullptr == fuel ?
static_cast<FuelCodeSize
>(INVALID_FUEL_CODE) : fuel->
code();
73 return nullptr == fuel ?
"NULL" : fuel->
name();
81 [[nodiscard]]
static constexpr MathSize
criticalRos(
const MathSize sfc,
const MathSize csi)
83 return sfc > 0 ? csi / (300.0 * sfc) : 0.0;
91 [[nodiscard]]
static constexpr bool isCrown(
const MathSize csi,
const MathSize sfi)
99 [[nodiscard]]
virtual MathSize
cfl()
const = 0;
109 const
bool can_crown) noexcept
132 return INVALID_CURING;
139 [[nodiscard]]
virtual MathSize
cbh()
const = 0;
152 [[nodiscard]]
virtual MathSize
probabilityPeat(MathSize mc_fraction)
const noexcept = 0;
165 [[nodiscard]]
virtual MathSize
buiEffect(MathSize bui)
const = 0;
181 MathSize isi)
const = 0;
189 MathSize isi)
const = 0;
214 MathSize rss)
const = 0;
226 [[nodiscard]]
constexpr const char*
name()
const
234 [[nodiscard]]
constexpr FuelCodeSize
code()
const
258template <
int BulkDensity,
int InorganicPercent,
int DuffDepth>
274 const bool can_crown,
275 const Duff* duff_ffmc,
276 const Duff* duff_dmc)
293 const MathSize rso)
const noexcept override
296 return cfl() > 0 ? max(0.0, 1.0 - exp(-0.230 * (rss - rso))) : 0.0;
303 [[nodiscard]] ThresholdSize
probabilityPeat(
const MathSize mc_fraction)
const noexcept override
309 constexpr auto pi = fi * pb;
311 constexpr auto ri = fi / (1 - fi);
312 constexpr auto const_part = -19.329 + 1.7170 * ri + 23.059 * pi;
314 return 1 / (1 + exp(17.047 * mc_fraction / (1 - fi) + const_part));
331 static const auto WFfmc = 0.25;
332 static const auto WDmc = 1.0;
333 static const auto RatioHartford = 0.5;
334 static const auto RatioFrandsen = 1.0 - RatioHartford;
335 static const auto RatioAspen = 0.5;
336 static const auto RatioFuel = 1.0 - RatioAspen;
337 const auto mc_ffmc = wx.mcFfmc() * WFfmc + WDmc;
338 static const auto McFfmcSaturated = 2.5 * WFfmc + WDmc;
339 static const auto McDmc = WDmc;
341 const auto prob_ffmc_peat_saturated =
probabilityPeat(McFfmcSaturated);
343 const auto prob_ffmc_peat_weighted = (prob_ffmc_peat - prob_ffmc_peat_saturated) / prob_ffmc_peat_zero;
346 McFfmcSaturated * 100);
348 const auto prob_ffmc_weighted = (prob_ffmc - prob_ffmc_saturated) / prob_ffmc_zero;
349 const auto term_otway = exp(-3.11 + 0.12 * wx.dmc().asValue());
350 const auto prob_otway = term_otway / (1 + term_otway);
357 const auto tot_prob = 1 - (1 - prob_ffmc_peat_weighted) * (1 - prob_ffmc_weighted) * ((1 - prob_otway) * RatioAspen + ((1 - prob_weight_ffmc_peat) * RatioHartford + (1 - prob_weight_ffmc) * RatioFrandsen) * ((1 - prob_weight_dmc_peat) * RatioHartford + (1 - prob_weight_dmc) * RatioFrandsen) * RatioFuel);
366 return BulkDensity / 1000.0;
374 return InorganicPercent / 100.0;
382 return DuffDepth / 10.0;
460 [[nodiscard]] MathSize
cbh()
const override;
465 [[nodiscard]] MathSize
cfl()
const override;
470 [[nodiscard]] MathSize
buiEffect(MathSize)
const override;
506 MathSize)
const override;
518 MathSize)
const noexcept override;
523 [[nodiscard]] ThresholdSize
probabilityPeat(MathSize)
const noexcept override;
Base class for DuffType.
Definition Duff.h:43
virtual ThresholdSize probabilityOfSurvival(MathSize mc_pct) const noexcept=0
Survival probability calculated using probability of ony survival based on multiple formulae.
Base class for all FuelTypes.
Definition FuelType.h:261
ThresholdSize probabilityPeat(const MathSize mc_fraction) const noexcept override
Calculate probability of burning [Anderson eq 1].
Definition FuelType.h:303
ThresholdSize survivalProbability(const wx::FwiWeather &wx) const noexcept override
Survival probability calculated using probability of ony survival based on multiple formulae.
Definition FuelType.h:321
static constexpr MathSize inorganicPercent()
Inorganic Percent (% / 100) [Anderson table 1].
Definition FuelType.h:372
static constexpr MathSize duffDepth()
DuffDepth Depth of Duff layer (cm) [Anderson table 1].
Definition FuelType.h:380
const Duff * duff_ffmc_
Type of duff near the surface.
Definition FuelType.h:420
const Duff * duff_dmc_
Type of duff deeper underground.
Definition FuelType.h:424
constexpr const Duff * duffDmcType() const
Type of duff deeper underground.
Definition FuelType.h:388
static constexpr MathSize ffmcRatio()
What fraction of the duff layer should use FFMC to determine moisture.
Definition FuelType.h:404
static constexpr MathSize dmcRatio()
What fraction of the duff layer should use DMC to determine moisture.
Definition FuelType.h:412
MathSize crownFractionBurned(const MathSize rss, const MathSize rso) const noexcept override
Crown Fraction Burned (CFB) [ST-X-3 eq 58].
Definition FuelType.h:292
constexpr FuelBase(const FuelCodeSize &code, const char *name, const bool can_crown, const Duff *duff_ffmc, const Duff *duff_dmc)
Constructor.
Definition FuelType.h:272
static constexpr MathSize bulkDensity()
Duff Bulk Density (kg/m^3) [Anderson table 1].
Definition FuelType.h:364
constexpr const Duff * duffFfmcType() const
Type of duff near the surface.
Definition FuelType.h:396
An FBP fuel type.
Definition FuelType.h:55
const char * name_
Name of the fuel.
Definition FuelType.h:242
virtual MathSize cfl() const =0
Crown fuel load (kg/m^2) [ST-X-3 table 8].
static constexpr bool isCrown(const MathSize csi, const MathSize sfi)
Whether or not this is a crown fire.
Definition FuelType.h:91
virtual MathSize grass_curing(const int, const wx::FwiWeather &) const
Grass curing.
Definition FuelType.h:129
constexpr bool canCrown() const
Whether or not this fuel can have a crown fire.
Definition FuelType.h:121
virtual MathSize calculateIsf(const SpreadInfo &spread, MathSize isi) const =0
Calculate ISI with slope influence and zero wind (ISF) [ST-X-3 eq 41/42].
virtual MathSize crownConsumption(MathSize cfb) const =0
Crown Fuel Consumption (CFC) (kg/m^2) [ST-X-3 eq 66].
virtual MathSize lengthToBreadth(MathSize ws) const =0
Length to Breadth ratio [ST-X-3 eq 79].
constexpr FuelCodeSize code() const
Code for this fuel type.
Definition FuelType.h:234
static constexpr const char * safeName(const FuelType *fuel)
Convert FuelType to its name, or 0 if nullptr.
Definition FuelType.h:71
virtual MathSize buiEffect(MathSize bui) const =0
BUI Effect on surface fire rate of spread [ST-X-3 eq 54].
static constexpr MathSize criticalRos(const MathSize sfc, const MathSize csi)
Critical rate of spread (m/min)
Definition FuelType.h:81
virtual MathSize cbh() const =0
Crown base height (m) [ST-X-3 table 8].
static constexpr FuelCodeSize safeCode(const FuelType *fuel)
Convert FuelType to its code, or 0 if nullptr.
Definition FuelType.h:62
virtual MathSize crownFractionBurned(MathSize rss, MathSize rso) const noexcept=0
Crown Fraction Burned (CFB) [ST-X-3 eq 58].
constexpr FuelType(const FuelCodeSize &code, const char *name, const bool can_crown) noexcept
Fuel type.
Definition FuelType.h:107
virtual MathSize criticalSurfaceIntensity(const SpreadInfo &spread) const =0
Critical Surface Fire Intensity (CSI) [ST-X-3 eq 56].
virtual MathSize probabilityPeat(MathSize mc_fraction) const noexcept=0
Calculate probability of burning [Anderson eq 1].
virtual ThresholdSize survivalProbability(const wx::FwiWeather &wx) const noexcept=0
Survival probability calculated using probability of ony survival based on multiple formulae.
FuelCodeSize code_
Code to identify fuel with.
Definition FuelType.h:250
virtual MathSize finalRos(const SpreadInfo &spread, MathSize isi, MathSize cfb, MathSize rss) const =0
Final rate of spread (m/min)
const bool can_crown_
Whether or not this fuel can have a crown fire.
Definition FuelType.h:246
virtual MathSize surfaceFuelConsumption(const SpreadInfo &spread) const =0
Surface fuel consumption (SFC) (kg/m^2) [ST-X-3 eq 9-25].
virtual MathSize calculateRos(int nd, const wx::FwiWeather &wx, MathSize isi) const =0
Calculate rate of spread (m/min)
constexpr const char * name() const
Name of the fuel.
Definition FuelType.h:226
Placeholder fuel that throws exceptions if it ever gets used.
Definition FuelType.h:431
MathSize buiEffect(MathSize) const override
Throw a runtime_error.
Definition FuelType.cpp:25
MathSize crownFractionBurned(MathSize, MathSize) const noexcept override
Throw a runtime_error.
Definition FuelType.cpp:57
MathSize calculateIsf(const SpreadInfo &, MathSize) const override
Throw a runtime_error.
Definition FuelType.cpp:37
MathSize crownConsumption(MathSize) const override
Throw a runtime_error.
Definition FuelType.cpp:29
MathSize lengthToBreadth(MathSize) const override
Throw a runtime_error.
Definition FuelType.cpp:45
MathSize calculateRos(int, const wx::FwiWeather &, MathSize) const override
Throw a runtime_error.
Definition FuelType.cpp:33
MathSize cfl() const override
Throw a runtime_error.
Definition FuelType.cpp:21
constexpr InvalidFuel(const FuelCodeSize &code, const char *name) noexcept
Placeholder fuel that throws exceptions if it ever gets used.
Definition FuelType.h:442
MathSize surfaceFuelConsumption(const SpreadInfo &) const override
Throw a runtime_error.
Definition FuelType.cpp:41
MathSize criticalSurfaceIntensity(const SpreadInfo &) const override
Throw a runtime_error.
Definition FuelType.cpp:53
MathSize grass_curing(const int nd, const wx::FwiWeather &wx) const override
Throw a runtime_error.
Definition FuelType.cpp:13
ThresholdSize survivalProbability(const wx::FwiWeather &) const noexcept override
Throw a runtime_error.
Definition FuelType.cpp:65
ThresholdSize probabilityPeat(MathSize) const noexcept override
Throw a runtime_error.
Definition FuelType.cpp:61
MathSize cbh() const override
Throw a runtime_error.
Definition FuelType.cpp:17
MathSize finalRos(const SpreadInfo &, MathSize, MathSize, MathSize) const override
Throw a runtime_error.
Definition FuelType.cpp:49
Information regarding spread within a Cell for a specific Scenario and time.
Definition FireSpread.h:30
A Weather value with calculated FWI indices.
Definition FWI.h:209