Materials¶
A material is a component whose payload is a named, versioned set of physical properties — water, structural steel, a customer-measured brine — conforming to a material schema. Being a component, a material has the registry's versioning, immutability, groups, permissions, dependency tracking and audit log, and its properties are validated against the physics vocabulary the moment it is registered.
This page is the one to read first. It explains the four things that make up materials in workflows — the schema, the material, the slot a workflow type declares, and the effective material a configuration ends up with — and points to the guides for each:
| You want to… | Read |
|---|---|
| build one material end to end, in 15 minutes | Build your first material |
| define the property set of a material family | Author a material schema |
| let a workflow type take a material | Add a material slot |
| add a material to the SimScale library | Contribute a library material |
| look up a declarator or a rule helper | Schema DSL, validation helpers |
Material schemas are data types¶
A material schema is an ordinary data type whose data
schema describes the property set of a material family (a fluid, a
solid, …) and which declares the MATERIAL role in its metadata
(roles = setOf(MATERIAL), see the roles of a data
type); the registry accepts
no other data type as a material schema. Schemas compose the shared property fragments under
simscale.physics.material-properties.* — density, dynamic
viscosity, Young's modulus, … — so the canonical field names of those
fragments are the property vocabulary every material speaks. Model
variants (a Newtonian vs. a power-law viscosity model) are subtypes of
a polymorphic compound, exactly as in any other schema. Each physics
aspect of a material — elasticity, plasticity, thermal conduction, … —
is one such compound with its own variants (including a "none" or
"constant" default), so a material combines behaviors by choosing a
variant per aspect; there is no subtype per combination. A property
that depends on a parameter is a table: a compoundTable of dimensional
columns behind a CONSTANT / TABLE choice, with the shared
interpolation and extrapolation fragments. The table names the columns
that index its rows — its axes, one or several — and that is what makes
the rows a table: a repeated or misordered combination is rejected when
the material enters the library (see author a material
schema
and tables in the schema DSL).
The material states how it wants to be read — between its rows, and beyond
each end — and whoever consumes it honours that: a slot taking a single
value derives one by reading the table at the parameter its analysis works
at, and a method receiving the whole table reads it the same way.
The curated schemas live under simscale.materials.schemas; an
organization can author its own schemas embedding the same fragments
plus proprietary fields.
Because the schema is a data type, everything a data type has applies
to a material schema: defaults, expert sections, a
dataSchemaValidationRuleSet carrying the physics constraints
(density > 0, Poisson ratio < 0.5, cross-field consistency checks),
and generated data and value models — the data model (through its
builder) is what a material's properties { } fills, the value model is
what slot rules and configuration mappings read.
The material component¶
A material names its schema with the version to depend on,
schema("group:id:version"); that one line is also its dependency
declaration, since a material depends on nothing else. Stored, the
schema reference is version-less and the declared dependency pins the
version, the same way a schema refers to a nested data type. Its
definition is:
| Field | Meaning |
|---|---|
schemaDataTypeReference |
the material schema, as group:id; must match a declared data type dependency |
properties |
a document in the schema's data-schema shape — the material's properties |
Registration runs the properties through the full configuration validation pipeline against the resolved schema: structural validation, default population, missing-value checks, then the schema's validation rule set and those of every nested data type. A material whose properties violate a rule (a negative density, a Poisson ratio of 0.7) is rejected at registration — the constraints are enforced once, at the source, not at every consumption site.
Everything else a material needs is generic component metadata: name,
descriptions, release notes, optional documentation pages, icon, custom
metadata (used for migration provenance), dependencies and the audit log. Registering,
promoting and releasing follow the ordinary component lifecycle:
authored as a snapshot, released as an immutable version. "Updating
water" means releasing water:1.1.0; anything referring to 1.0.0
keeps 1.0.0 until moved explicitly.
Release integrity treats the schema as the only dependency a material uses: the declared dependencies must be exactly the material schema (and nothing that goes unused).
Authoring a material¶
A material is a .material.kts in the unified DSL:
material {
metadata {
reference = "simscale.test:test-water:1.0.0"
name = "Water"
description = "Liquid water at 20 °C, 1 atm."
customMetadata("source", "Measured at 20 °C and 1 atm")
}
schema("simscale.test:test-fluid-material-schema:1.0.0")
properties {
name = "Water"
fluidType = FluidType.LIQUID
density = 997.33.kilogram_per_cubic_meter
dynamicViscosity = 0.000931297.pascal_second
}
}
The properties { } block is applied to the schema's generated data
model builder: it holds constants by construction, a mandatory property
left unset fails the build by name, schema defaults are preset, nested
compounds have a block named after them and polymorphic ones a function
per variant, and units, enums and variants are checked when the material
is built;
propertiesJson("…") is the untyped alternative for generated or
migrated materials — the form simkit component generate-dsl renders,
and the one to choose when a converter produces the document; nothing
checks it at build time, the registry validates it at registration.
simkit component build produces the registration envelope,
simkit component test runs a sibling .material.test.kts against
the serialized properties document, and simkit component register
registers it. The envelope simkit component build produces:
{
"reference": "simscale.test:test-water:1.0.0",
"type": "MATERIAL",
"formatVersion": 1,
"package": {
"name": "Water",
"description": "Liquid water at 20 °C, 1 atm.",
"schemaDataTypeReference": "simscale.test:test-fluid-material-schema",
"properties": {
"name": "Water",
"fluidType": "LIQUID",
"density": { "value": 997.33, "unit": "kg/m³" },
"dynamicViscosity": { "value": 0.000931297, "unit": "Pa⋅s" }
},
"dependencies": [ "simscale.test:test-fluid-material-schema:1.0.0" ]
}
}
The registry keeps the definition together with the schema version the declared reference resolves to, and the SimKit UI renders it as a material view: metadata, a link to the schema, and the properties rendered against the resolved schema.
Using materials in workflow types¶
A workflow type that depends on a material schema (a data type
declaring the MATERIAL role) gets a material slot declarator,
<camelCaseId>Material(name), for its configuration schema (see the
schema DSL reference).
The slot's value is a reference to a material component version,
optionally with overrides, or an inline material — all validated
against the material schema. A slot can forbid customization and
carry suitability rules over a candidate material's properties, so a
picker can explain why a material does not fit.
Materialization¶
A material reference is resolved when the configuration is validated
(workflow-repository) and when a run is processed (workflow-runner):
the referenced material's properties are looked up in the registry as the
calling user, projected into the slot's schema shape — copied by
field name, recursively, dropping whatever the slot does not declare —
and the reference's overrides are deep-merged on top. From there
on the slot holds a plain document of the material schema: the
schema's rule set, the slot's suitability rules and the workflow
type's own rules all judge that effective material, and value models
and methods only ever see documents.
Because materialization is structural, a material authored against
one schema serves any slot whose declared fields it covers; a
property the slot needs but the material lacks surfaces as an ordinary
missing_value finding on the slot's path. An override that switches
the variant of a polymorphic compound (its type differs from the
material's) replaces that compound as a whole, so no field of the
previous variant lingers.
Only the dependency-resolved configuration schema carries a slot's
inlined material schema (its fields, subtypes and
associatedDataType); the unresolved element is a shell naming the
schema by reference.
Reading a material definition, and therefore materializing a reference to it, requires the USE permission on the material version (snapshots follow the general state and permission rule: TEST permission); the registry checks it for the calling user on every read, so nothing is served from a cache to a user who may not use the material.
The findings a material slot can produce, all reported at the slot's path unless noted:
| Rule code | Case code | When | details |
|---|---|---|---|
invalid_material_reference |
same | the reference's material is missing or is not a component version reference |
reason |
unknown_value |
same | a reference node carries a property other than the discriminator, material and overrides; reported at that property's path |
— |
material_customization_not_allowed |
same | the slot has allowsCustomization = false and the value carries overrides or is an inline document |
— |
invalid_data_type, unknown_value, … |
as for any compound | shape errors inside overrides (partial by nature: completeness is never checked), at …/overrides/<field>; inline documents are validated as documents of the material schema |
— |
non_existent_material |
same | no material version is registered under the reference | material_reference |
material_not_accessible |
same | the user lacks the permission to use the material version | material_reference |
material_without_properties |
same | the material definition carries no platform-side properties | material_reference |
material_resolution_unavailable |
same | the registry could not be asked (no resolver in this context, or the registry failed); retrying is the remedy | material_reference |
An unresolvable reference is the only finding validation reports for its slot: the rules that would read the slot's properties are silenced for that slot, since they could only restate the same cause.
Released material versions are immutable, so a configuration pinned
to water:1.2.0 yields the same effective material in every run. A
floating reference (…-SNAPSHOT-latest) behaves as any floating
dependency: fine while developing, resolved to the snapshot it stands for
whenever the configuration is judged or run — and the effective material
names that snapshot.
Customizing a material¶
A slot's value takes three shapes, and a user moves between them without leaving the configuration:
- a reference —
{ "configuration_reference_type": "material", "material": "group:id:1.2.0" }: the material as the library has it; - a reference with
overrides— a partial document in the schema's shape, deep-merged onto the material's values: the user changed a few numbers and kept the rest linked to the library version; - an inline document — a material spelled out in place, for values the library does not have.
Customizing therefore never copies a material into the configuration:
the reference stays, the overrides are the diff, and a new library
version leaves the customization intact. A slot declared with
allowsCustomization = false accepts the bare reference only
(material_customization_not_allowed otherwise). Each customization is
an ordinary new workflow version.
The effective material¶
What a configuration ends up holding in a slot is the effective material: the referenced material's properties projected into the slot's shape, the overrides merged on top, the values the slot derives written in (a table read at the analysis' reference temperature, say — see add a material slot), and the schema's defaults filled where nothing else spoke. That document is what the validation rules judge and what a run hands to methods, assembled the same way for both.
Every field of it carries a provenance — where its value came from — in precedence order:
| Provenance | Meaning |
|---|---|
OVERRIDE |
the user's own value, from the reference's overrides |
INLINE |
authored in place: the slot holds a document, not a reference |
DERIVED |
computed by the slot from what the material carries |
MATERIAL |
copied from the referenced material — named with the version it resolved to |
SCHEMA_DEFAULT |
the schema's default, since neither the material nor the user set it |
The effective material of a stored workflow version, its provenance and
the validation results over it are one read:
simkit workflow version effective-configuration <version-id>, or the
version's page in the SimKit UI. A user interface builds its material
view from exactly this — read-only where a value is the material's,
editable where it is overridden or inline, explained where it is derived.
Discovery¶
Two commands answer the questions a material picker asks, judging materials the same way validation does (projection into the slot's shape, the schema's rules, the slot's suitability rules) and returning the findings that explain a miss:
simkit component suitable-materials <workflow-type> <slot-path> [--states …] [--all]lists the materials the caller may use, judged against one slot of a workflow type version. The slot path is the slot's configuration path with*standing for list elements (/fluid,/materials/*/material). Only released materials are judged unless--statessays otherwise; of a snapshot version only the latest snapshot is judged. Candidates are not limited to materials of the slot's own schema: any material whose properties cover the slot fits.simkit component material-slots <material> [--states …]lists the material slots of workflow type versions bound to the material's schema (any version of that schema), each judged for that material. Snapshot and released workflow types are considered unless--statessays otherwise. The SimKit UI shows the same on the material's page.
Both queries filter by component permissions before judging anything: a material or workflow type the caller may not use is simply absent.
Component version search takes a component kind
(simkit component search --component-type MATERIAL …), so a library
browser can search materials only.