@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
151 lines (149 loc) • 4.98 kB
JavaScript
import {
ParameterLookupTable
} from "../../../../engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js";
/**
* 🔥 SMOKE (Brown Carbon / Organic aerosol): complex refractive index m = n + i k, wavelength in nm.
* Assumptions: dry organic aerosol ("brown carbon"), ~300 K, bulk-effective constants; morphology not modeled.
* Purpose: radiometrically useful across 200–20,000 nm for graphics and physics; linear interpolation via ParameterLookupTable.
*
* Spectral behavior encoded (representative):
* - UV (200–380 nm): strong absorption (large k), n slightly higher.
* - Visible (400–700 nm): moderate dispersion, weak-to-moderate absorption decreasing toward red (brownness).
* - NIR/SWIR (0.75–2.5 µm): generally weak k with small overtone bumps near 1.4–2.0 µm.
* - Mid-IR (2.7–5 µm): strong organic stretch complex near 3.2–3.5 µm (elevated k).
* - LWIR (6–12 µm): carbonyl/other organic modes around ~6 µm and bands near 6.8–7.3 µm; modest tail beyond.
*
* Composite guidance/sources: Kirchstetter et al. (2004) AAE for brown carbon; Hoffer et al. (2006);
* Sumlin et al. (2017); generic organic/polymer optics (Querry compendium) for MIR/LWIR band shapes.
* Values are smooth/representative for modeling; species- and burn-condition variability is not captured.
*/
const SMOKE_REFRACTION_INDEX_LUT = ParameterLookupTable.from(
2, // columns: [n, k]
[
// UV (short-wave)
1.660, 3.00e-1, // 200 nm
1.630, 1.80e-1, // 220 nm
1.610, 1.00e-1, // 240 nm
1.600, 6.00e-2, // 260 nm
1.595, 3.50e-2, // 280 nm
1.590, 2.00e-2, // 300 nm
1.585, 1.20e-2, // 320 nm
1.580, 8.00e-3, // 340 nm
1.575, 6.00e-3, // 360 nm
1.570, 5.00e-3, // 380 nm
// Visible (brownness: stronger in blue, weaker toward red)
1.568, 4.50e-3, // 400 nm
1.562, 3.00e-3, // 450 nm
1.558, 2.00e-3, // 500 nm
1.555, 2.00e-3, // 550 nm
1.553, 1.60e-3, // 600 nm
1.551, 1.30e-3, // 650 nm
1.550, 1.10e-3, // 700 nm
// NIR/SWIR (overtone/combination features are mild)
1.5495, 1.00e-3, // 750 nm
1.5490, 1.00e-3, // 800 nm
1.5480, 1.20e-3, // 900 nm
1.5475, 1.50e-3, // 1000 nm
1.5470, 1.60e-3, // 1064 nm
1.5460, 1.80e-3, // 1200 nm
1.5455, 2.20e-3, // 1300 nm
1.5450, 4.50e-3, // 1450 nm (overtone bump)
1.5445, 3.50e-3, // 1550 nm
1.5440, 3.00e-3, // 1650 nm
1.5435, 2.80e-3, // 1750 nm
1.5430, 6.00e-3, // 1940 nm (combination region)
1.5428, 5.50e-3, // 2000 nm
1.5425, 6.00e-3, // 2200 nm
1.5420, 7.00e-3, // 2400 nm
1.5418, 8.00e-3, // 2500 nm
// Mid-IR (2.7–5 µm): organic stretch complex near 3.2–3.5 µm
1.5415, 1.20e-2, // 2700 nm
1.5420, 3.00e-2, // 2900 nm
1.5430, 1.00e-1, // 3000 nm
1.5450, 1.80e-1, // 3100 nm
1.5470, 2.40e-1, // 3200 nm
1.5480, 2.70e-1, // 3300 nm
1.5485, 2.80e-1, // 3400 nm (peak)
1.5480, 2.40e-1, // 3500 nm
1.5470, 1.40e-1, // 3700 nm
1.5460, 8.00e-2, // 4000 nm
1.5450, 5.00e-2, // 4500 nm
1.5440, 3.50e-2, // 5000 nm
// Long-wave IR (5–20 µm): ~6 µm and 6.8–7.3 µm bands, modest tail
1.5435, 1.00e-1, // 6000 nm (≈6 µm band)
1.5430, 1.30e-1, // 6800 nm (6.8 µm feature)
1.5428, 1.10e-1, // 7000 nm
1.5424, 9.00e-2, // 7500 nm
1.5420, 7.50e-2, // 8000 nm
1.5415, 6.00e-2, // 9000 nm
1.5410, 8.00e-2, // 10000 nm
1.5400, 6.00e-2, // 12000 nm
1.5390, 4.50e-2, // 15000 nm
1.5380, 3.50e-2, // 20000 nm
],
[
200,
220,
240,
260,
280,
300,
320,
340,
360,
380,
400,
450,
500,
550,
600,
650,
700,
750,
800,
900,
1000,
1064,
1200,
1300,
1450,
1550,
1650,
1750,
1940,
2000,
2200,
2400,
2500,
2700,
2900,
3000,
3100,
3200,
3300,
3400,
3500,
3700,
4000,
4500,
5000,
6000,
6800,
7000,
7500,
8000,
9000,
10000,
12000,
15000,
20000
]
);
/**
* 💨 SMOKE (Brown Carbon / Organic aerosol)
* @param {number[]} result complex number, refraction index
* @param {number} wavelength_nm in nanometers
*/
export function ri_smoke(result, wavelength_nm) {
SMOKE_REFRACTION_INDEX_LUT.sample(wavelength_nm, result);
}