Chemistry · class

RadiativeSources

The radiating things in a scene this tick: flames and hot surfaces both.

Explained in Chemistry.

class RadiativeSources
import { RadiativeSources } from '@driftengine/chemistry';

In depth

Gathered into columns once per tick and read many times, which is why it is a structure rather than a callback. Cleared and refilled rather than reallocated.

Accessors

NameTypeDescription
countgetnumber

Methods

clear

clear(): void

add

add(x: number, y: number, z: number, temperature: number, area: number, power: number): void
ParameterTypeDescription
xnumber
ynumber
znumber
temperaturenumber
areanumber
powernumberW, which decides how far this source is worth testing against.

temperatureOf

temperatureOf(source: number): number
ParameterTypeDescription
sourcenumber

areaOf

areaOf(source: number): number
ParameterTypeDescription
sourcenumber

reaches

reaches(source: number, x: number, y: number, z: number): boolean

Whether a point is inside this source's own reach.

ParameterTypeDescription
sourcenumber
xnumber
ynumber
znumber

fluxAt

fluxAt(x: number, y: number, z: number, surfaceTemperature: number, emissivity: number, occluded: OcclusionTest | null): number

Total flux onto a point from every source that can see it, W/m².

ParameterTypeDescription
xnumber
ynumber
znumber
surfaceTemperaturenumber
emissivitynumber
occludedOcclusionTest | null
More

The receiver is treated as facing each source — a parcel is a lump rather than a plane, so there is no one normal to take a cosine against. What that costs is that a flat plate edge-on to a fire receives as much as one facing it; what it buys is not asking a consumer for a normal per parcel, which is a number most of them do not have.

hottestAt

hottestAt(x: number, y: number, z: number, occluded: OcclusionTest | null): number

The temperature of the hottest source that reaches a point, or zero where none does.

ParameterTypeDescription
xnumber
ynumber
znumber
occludedOcclusionTest | null
More

What a radiative exchange is bounded by, and the reason it has to be bounded at all: the radiative term is explicit, so a parcel whose surface shell has a small heat capacity — a coin, a nail, a leaf — can absorb more in one step than would take it past the source that is heating it, and then radiate the excess back as T⁴ and ring itself to pieces. It was found by putting a copper coin on a hearth in demo/dev/chemistry.ts, where it reached 4,000 K on the first step and 100 K a minute later.

Nothing can be heated past the thing heating it, so this is the equilibrium the step may reach and not exceed — which is what an implicit solve would give and costs one comparison per source.

reachesPoint

reachesPoint(x: number, y: number, z: number): boolean

Whether any source reaches a point at all, which is the whole of the wake test.

ParameterTypeDescription
xnumber
ynumber
znumber
More

§14's scan has to be coarse or sleeping saves nothing: this is a range comparison per source and no view factor, no temperature and no occlusion ray. A source's range already comes from its own power, so a bonfire wakes a parcel a candle would not.