flutter3d_matter library
What a world and the things in it are made of, with nothing that moves them.
- WorldProperties: a world's gravity, its air, its wind and the medium
things move through, with the defaults a world nobody configured starts
with (standardGravity, standardAtmosphere, standardAirTemperature
and the rest, in
standard_world.dart) and the laws that derive the air from them (airDensityAt, speedOfSoundAt); - PhysicalMaterial: one substance's mechanical, fluid, thermal, acoustic, optical and electrical properties, each group citing its source, and the MaterialPairs measured between two of them;
- MaterialCatalog: the materials an engine knows by id, the engine's
own (Materials,
f3d.*) and its plugins'; and - the constants of nature the engine uses (stefanBoltzmann, molarGasConstant and the rest).
Its own package, below the physics, because more than the physics reads
it. The audio reckons a Doppler shift against the world's speed of
sound, the particles fall by its gravity and drift on its wind, and the
native core's C header is generated from the catalogue. None of them
steps a body, and none of them should need the collision world to know
what the air is. flutter3d_physics re-exports this library while the
packages that read it through the physics move to it.
docs/CONTRACTS.md ("World properties", "Physical materials") gives the
unit of every number here.
Classes
- AcousticProperties
- How a material meets sound: what a surface of it absorbs, band by band, and how fast sound crosses it.
- Confidence
- How a value was come by: measured, read from a handbook, or estimated.
- ConstantLaw
- A value the same at every state: the catalogue's number with nothing known of how it changes.
- ConstitutiveModel
- A constitutive model of how a material gives way past the elastic: its model's name and its parameters, as the paper that fitted it gives them.
- ContactProperties
- What two bodies meeting do: what a solver reads at a contact, and how far to trust it.
- ElectricalProperties
- How a material carries a current.
- ExternalIdSpace
- The spaces of ids other systems know a substance by (PhysicalMaterial.externalIds), by their names as a material's document writes them.
- FluidProperties
- How a liquid or a gas flows: its viscosity, its surface's pull and how hard it is to squeeze. Its density is its MechanicalProperties.density.
- FormulaLaw
-
A value given by a formula of the engine's expression language, over the
state's quantities by the symbols inputs binds:
T, the temperature in K, andp, the pressure in Pa, unless it says otherwise. - GeoOrigin
- A place on the Earth that a world's origin stands on, and the frame the world's axes keep there.
- InelasticProperties
- How a material gives way past the elastic: how much of a vibration it turns to heat each cycle, and the models of its large strains, its creep and its flow.
- LawInput
- One quantity of a MatterState a law reads: its id, its unit, and the range the law is valid over.
- MaterialCatalog
-
The physical materials one engine knows, by id, and the pairs measured
between them: the engine's own (Materials, under
f3d.*) and every plugin's. - MaterialPair
- How two materials meet when the catalogue holds a measurement of the pair itself, in place of MaterialCatalog.contact's rule.
- MaterialPhase
- What state a material is in at its quoted temperature and pressure.
- Materials
-
The engine's built-in materials and the pairs measured
between them: what
MaterialCatalog.builtInholds. - MatterState
- The state one body of a material is in: an open set of quantities, each under a namespaced id, and the phase it is in.
- MechanicalProperties
- How a material holds together and meets another: its density, its stiffness and strength, and its contact.
- OpticalProperties
- How a material meets light: what it bends, absorbs and reflects.
- PhysicalMaterial
- A substance and what is known of it: its density, stiffness and contact, its flow, its heat, its sound, its light and its current, each a group that may be absent, each naming its source.
- PropertyGroup
- What every group of a material's properties has: the source its numbers were read from, and the keys of its file a later version wrote that this one does not know, kept so they are written back.
- PropertyInterval
- The spread a value is known within: the low and high ends of a range a source gives, in the property's unit.
- PropertyLaw
- One property of a material as a function of the state a body of it is in: a constant, a table, or a formula of the engine's expression language.
- RgbValues
- Three numbers for the red, green and blue of linear light: a reflectance, or a coefficient per metre — the field that holds one says which.
- TableLaw
- A value tabulated against one quantity of the state, read between the points on a straight line.
- ThermalProperties
- How a material takes heat, gives it off, changes phase and burns.
- WorldProperties
- The properties of one world, read by everything in it.
- WorldPropertiesPatch
- The fields of a WorldProperties something sets, and nothing it does not.
Constants
- airHeatCapacityRatio → const double
- Dry air's ratio of specific heats, γ = c_p / c_v: 1.4, a diatomic gas's, to the three figures it holds from the freezing point to a few hundred degrees (CRC Handbook of Chemistry and Physics). No unit.
- boltzmannConstant → const double
- The Boltzmann constant, J/K. Exact by the SI's definition (2019).
- lorenzNumber → const double
- The Sommerfeld value of the Lorenz number, W·Ω/K²: π²/3 · (k_B/e)², 2.44 × 10⁻⁸. The Wiedemann–Franz law's constant: a metal whose heat is carried by its electrons conducts k = L·T/ρ at a temperature T and a resistivity ρ (Kittel, Introduction to Solid State Physics, 8th ed., ch. 6), within about ten per cent for the common metals near room temperature.
- materialPairsSection → const DataSection
-
A data plugin's
materialPairs: how one of its substances meets another material (MaterialPair), installed into the engine's MaterialCatalog. - molarGasConstant → const double
- The molar gas constant, J/(mol·K): the Boltzmann constant times Avogadro's, both exact since 2019 (CODATA 2018).
- molarMassOfDryAir → const double
- Dry air's molar mass, kg/mol: 0.028 964 7 (Picard and colleagues, "Revised formula for the density of moist air (CIPM-2007)", Metrologia 45, 2008).
- physicalMaterialsRequirement → const String
-
What a data plugin's document names in its
requireswhen it brings substances: physicalMaterialsSection or materialPairsSection. - physicalMaterialsSection → const DataSection
-
A data plugin's
physicalMaterials: substances, each a PhysicalMaterial's fields with its id<plugin id>.<name>, installed into the engine's MaterialCatalog so a level, a world's medium or a collider can name them. -
propertyUnits
→ const Map<
String, Unit> -
The unit of every scalar property, by
<group>.<property>: what its PropertyLaw gives, and what a formula law's value must measure. - standardAirDensity → const double
- Dry air's density at standardAirTemperature and standardAtmosphere, kg/m³ (ρ = p M / R T, with M = 0.028 964 7 kg/mol).
- standardAirTemperature → const double
- The air's temperature in a world nobody has warmed or cooled, K: 20 °C, the room a laboratory's tables are measured at.
- standardAtmosphere → const double
- The air's pressure at sea level, Pa: one standard atmosphere, 101 325 Pa by definition (10th CGPM, 1954).
- standardGravity → const double
- The acceleration a body falls with at the Earth's surface, m/s²: standard gravity, 9.806 65 m/s² by definition (3rd CGPM, 1901), to the three figures the core has always used.
- standardRelativeHumidity → const double
-
The air's relative humidity in a world nobody has dampened or dried, from
nought to one: half saturated, a heated room's. What open liquid
evaporates into (
FluidAirinflutter3d_physics); dry air's density, standardAirDensity, is what every body is dragged by whatever the humidity, as it always was. - standardSpeedOfSound → const double
- How fast sound travels in dry air at standardAirTemperature, m/s: 343, from c = √(γ R T / M) with γ = 1.4. What a Doppler shift is reckoned against when the listener's world says nothing else; speedOfSoundAt gives it at another temperature.
- stefanBoltzmann → const double
- The Stefan–Boltzmann constant, W/(m²·K⁴): what a black surface at a temperature T radiates a square metre, σT⁴. Exact since the 2019 redefinition of the SI, which fixed the Boltzmann and Planck constants it is made of (CODATA 2018).
- zeroCelsius → const double
- Water's freezing point at one standard atmosphere, K: the zero of the Celsius scale. What a temperature in °C is offset by.
Properties
- standardGravityVector → Vector3
-
standardGravity as a vector, down the y axis. A fresh one each call: a
Vector3is mutable, and a shared one could be scaled in place.no setter
Functions
-
airDensityAt(
double temperature, double pressure) → double -
Dry air's density at
temperature, K, andpressure, Pa, kg/m³. -
checkMaterialCatalog(
MaterialCatalog catalog, {bool frictionForSolids = false}) → List< String> -
What is wrong with the shape of
catalog, one sentence each; empty when nothing is. -
speedOfSoundAt(
double temperature) → double -
How fast sound travels in dry air at
temperature, K, m/s.
Exceptions / Errors
- GeoOriginFormatException
- A geo origin in a document that cannot be read.
- MaterialFormatException
-
A physical material's document — a
PhysicalMaterial's JSON, a data plugin'sphysicalMaterialsentry — that cannot be read: a number that is not one, a group with no source, a phase or an id that is not a word. - MaterialRegistrationException
- A material or a pair a MaterialCatalog would not take: an id already taken, a plugin's id outside its namespace, an entry whose numbers PhysicalMaterial.problems finds implausible.
- UnknownMaterialException
- A material asked for by an id no material in the catalogue has: a level, a world or a save naming a substance a plugin brings, with that plugin not installed.
- WorldPropertiesFormatException
-
A world's properties in a document — a level's
world, a snapshot — that cannot be read.