Reference: schema description language¶
Every field declaration available inside dataSchema { },
metadataSchema { }, and configurationSchema { } blocks. For the
conceptual overview, see
concepts: schema language.
The DSL receiver is SchemaDefinition (or a
nested NestedSchemaField / AbstractCompoundField inside compound
records). Sources: framework/schema/src/main/kotlin/.../elements/.
Atomic fields¶
Each takes a name and an optional default; a configuration lambda takes label / doc / per-field options.
boolean(name: String, default: Boolean? = null) { /* options */ }
integer(name: String, default: Long? = null) { /* options */ }
real(name: String, default: Double? = null) { /* options */ }
string(name: String, default: String? = null) { /* options */ }
Underlying types: BooleanField, IntegerField, RealField,
StringField. Sources under elements/atomic/.
Enum field¶
enum(
name: String,
typeName: String,
values: List<String>,
default: String? = null,
valueLabels: Map<String, EnumValueLabel> = emptyMap(),
) { /* options */ }
typeName is the enum's type name as referenced in value-model
expressions. valueLabels provides per-value display labels for the
UI.
Underlying type: EnumField.
Compound field¶
A record of fields, possibly polymorphic.
Inside the body the receiver is NestedSchemaField — same
declarators (atomic, enum, compound, list, dimensional…) work
recursively.
For polymorphism, the framework supports compound subtyping via a
discriminator field; see source comments in
AbstractCompoundField.kt for the API.
Underlying type: CompoundField.
List counterparts¶
Every field type has a list version:
booleanList(name: String) { /* options */ }
integerList(name: String) { /* options */ }
realList(name: String) { /* options */ }
stringList(name: String) { /* options */ }
enumList(name: String, typeName: String, values: List<String>, …) { /* options */ }
compoundList(name: String) { /* nested fields */ }
dimensionalScalarList(name: String, metricUnits: UnitProfile, …) { /* options */ }
dimensionalVectorList(name: String, metricUnits: UnitProfile, …) { /* options */ }
entityAssignmentList(name: String, entityType: EntityType) { /* options */ }
A list (or an entity assignment, single or list) that must not stay
empty says so with nonEmpty:
compoundList("presets") {
nonEmpty = true // at least one preset must be defined
string("name")
}
cadSolidList("solids") { nonEmpty = true } // something must be assigned
cadSolid("rotatingBody") { nonEmpty = true } // the single assignment is mandatory
nonEmpty is the counterpart of optional for the fields whose "nothing"
is an empty value rather than a missing one — whether that nothing is
stored as null or as an empty collection is a representation detail.
User interfaces read it to tell what must be filled in, and structural
validation enforces it (error empty_value at the field's path) — no
validation rule to write or keep in sync. Finer cardinality requirements
(at least two, at most fifty, cross-field limits) are count rules — see
validation helpers.
Tables¶
A list whose rows are indexed by some of their own columns is a table.
compoundTable says which columns those are:
compoundTable("thermalConductivityPoints") {
label("Thermal conductivity over temperature")
axis { dimensionalScalar("temperature", metricUnits = UnitProfile(KELVIN, listOf(CELSIUS))) }
value { dimensionalScalar("thermalConductivity", metricUnits = UnitProfile(WATT_PER_METER_PER_DELTA_KELVIN)) }
}
axis { } and value { } take the same field declarations as
compoundList { } — an axis column is an ordinary field and gets its
quantity, units and options from its own declaration. What the two blocks
add is the distinction: the axes index the rows, the values are what the
rows carry at each combination. Declare several axes for a table over
several parameters:
compoundTable("densityPoints") {
axis { dimensionalScalar("temperature", metricUnits = UnitProfile(KELVIN)) }
axis { dimensionalScalar("pressure", metricUnits = UnitProfile(PASCAL)) }
value { dimensionalScalar("density", metricUnits = UnitProfile(KILOGRAM_PER_CUBIC_METER)) }
}
Declaring the axes buys three things:
- Structural validation. The rows must be ordered by the axes taken
in turn and must carry each combination once — errors
unordered_table_rowandrepeated_table_rowat the offending row. Ordering is judged on magnitudes in SI units, so 20 °C sorts after 200 K however the numbers read. Nomonotonicoruniquerule to write; an ordinarycompoundListis still judged as a list, where repeats and any order are normal. - Reading.
interpolateandsectionAtread a table at a parameter. They rely on the ordering the axes enforce. - Presentation. User interfaces render a table as a table and know which columns are the axes.
A table may be sparse — measured data rarely covers a full grid, and a combination that was never measured is simply absent. A schema whose reading needs the surrounding corners states that with a rule of its own.
A table is a list, so everything list-shaped still applies: nonEmpty,
count rules, modelFieldName.
Declare an axis as a dimensionalScalar rather than a real, even where the quantity is dimensionless: the reading helpers compare axis values as magnitudes, so they take a dimensional. A plastic strain or a mass fraction gets UnitProfile(ONE, listOf(PERCENT)) — which also lets the value be written in percent, as such quantities usually are.
Dimensional fields¶
Atomic dimensional scalar / vector with a unit profile:
dimensionalScalar(
name: String,
metricUnits: UnitProfile,
default: DimensionalScalar<*>? = null,
) { /* options */ }
dimensionalVector(
name: String,
metricUnits: UnitProfile,
default: DimensionalVector<*>? = null,
) { /* options */ }
Per-quantity shortcuts come from the corresponding data type
dependency. When a component depends on
simscale.physics.dimensionals.scalars:length:1.0.0, length(name)
appears in scope (and lengthList, etc.). Same for time,
pressure, temperature, velocity, etc.
A standalone unit field (no value, just the unit slot):
Entity assignments¶
References to geometric entities of an input data instance.
entityAssignment(name: String, entityType: EntityType) { /* options */ }
entityAssignmentList(name: String, entityType: EntityType) { /* options */ }
EntityType is one of FACE, EDGE, VOLUME, etc. (full enum in
framework/entity-assignments/...EntityType.kt).
Expert sections¶
configurationSchema {
integer("normal", default = 100)
expert {
real("residualThreshold", default = 1e-6)
compound("convergenceTuning") {
real("relaxationFactor", default = 0.7)
}
}
}
Every field, subtype, and nested compound (recursively, descendants
included) added inside expert { } carries expert = true. Build
and registry both reject schemas whose expert sections have any
field without a default — see
concepts: expert sections
for the exact rules.
Per-field options (the lambda body)¶
Common options every field accepts:
real("threshold") {
label("Threshold") // primary user-visible label
label(Locale.GERMAN, "Schwelle") // per-locale label
doc("Convergence threshold; lower is stricter.") // help text
doc(Locale.GERMAN, "...") // per-locale help
optional = true // whether the field is required (default false)
}
realList("samples") {
nonEmpty = true // lists and entity assignments only: must not stay empty (default false)
}
Some fields have per-type options (e.g. enum accepts valueLabels,
dimensionalScalar accepts metricUnits). See the source for the
exhaustive list.
Reusing data types as field types¶
When a component declares a data-type dependency, that data type's schema becomes a field declarator in the consumer's DSL — its schema injection function:
configurationSchema {
nativeTestMethodOutputItem("solverLogConfig") {
doc("Whether to produce the solver log.")
}
}
Function name is camelCase from the data type's id. The function's
body (when not empty) supports the same per-field options as
above (label, doc, optional), which override the embedded
data type's own; the field's internal shape comes from the
dependency's dataSchema { }.
*List companions are also generated:
nativeTestMethodOutputItemList(name) { … }.
The contract:
- Available in every schema block —
configurationSchema { }(method / workflow type),dataSchema { },metadataSchema { }— and inside nestedcompound { }/compoundList { }bodies. - Only the data schema is injected. The injection function embeds
the dependency's
dataSchema { }; a data type with an empty data schema yields an empty record, so don't embed opaque data types. - The stored reference is version-less. The schema records
group:id; the version is recovered from the consumer'sdependencies { }declaration. A reference with no matching declared dependency fails the build and is rejected by the component registry at registration. - Inline schemas inject their single field. A dependency declared
with
dataSchema(inline = true)(exactly one field required) injects that field directly instead of a one-field record — this is howlength("x"),time("t"), … work. - An enum type is declared once per schema. An inline enum fragment embedded in several places of one schema (the interpolation choice of two tables) generates one enum class, declared by the first occurrence and used by the others; the occurrences must agree on the values, or the build refuses the schema. An inline fragment generates no model of its own — the embedding schema's models carry its types.
Concept-level coverage: data types — embedding.
Material slots¶
Every data-type dependency declaring the MATERIAL role (see
the roles of a data type)
also yields a material declarator, <camelCaseId>Material(name)
(plus *MaterialList), which adds a material slot bound to that
data type as its material schema. Using the declarator of a dependency
that does not declare the role fails the build with an unresolved
reference; the build names the data type, its declared roles and the
roles = setOf(MATERIAL) line to add.
configurationSchema {
compoundList("materials") {
fluidMaterial("material") { candidate ->
label("Fluid material")
allowsCustomization = false
suitability {
rule(candidate.fluidType, name = "Liquids only", code = "liquid_only") {
error(condition = candidate.fluidType equal FluidType.LIQUID.asValueModel(), message = "This solver supports liquids only.", code = "not_a_liquid")
}
}
}
bodyList(allowedSourceTypes = setOf(SourceType.CAD, SourceType.MESH), name = "regions") { label("Assigned regions") }
}
}
FluidType is the enum the material schema's code generation produced
for its fluidType field; declaring the data-type dependency brings the
schema's generated package into scope, so it needs no import.
The slot's value is a material conforming to the schema — one of:
- a reference to a material component version:
{ "configuration_reference_type": "material", "material": "simscale.materials.library.fluids:water:1.2.0" }; - a reference with overrides, a partial document in the schema's
shape whose values replace the referenced material's field by field.
On a polymorphic schema, overrides that name a
typeselect that variant; overrides without atyperefine the referenced material's variant and are checked for shape against all variants' fields; - an inline material: a plain document in the schema's shape.
Per-slot options, on top of the common ones:
allowsCustomization(defaulttrue) — setfalseto accept pure references only; overrides and inline materials are then rejected at validation.suitability { … }— validation rules over a candidate material's values (thecandidatevalue model the declarator hands to the body, typed by the material schema). A material failing a rule with error severity does not suit the slot; the findings say why.
A material slot has no default — the user picks or spells out a
material — so it cannot live inside an expert { } section, which
must be fully defaulted.
Structurally the slot behaves like an embedded data type: the schema
records the version-less group:id, the version comes from
dependencies { }, and the material schema's fields are inlined into
the slot when dependencies are resolved. Generated data and value
models type the slot by the material schema's own models — references
are materialized into the effective document before configurations
reach value models or methods. Concept-level coverage:
materials.
Simulation connections¶
simulationConnections(name, cadInput = …, grouping = …) { … } adds a
simulation connections field: the connection defaults, the switch
that ignores the detected contacts, and the user's corrections, fed by
the contacts the platform detects on the CAD model of the cadInput
input.
configurationSchema {
simulationConnections("connections", cadInput = "geometry", grouping = ConnectionGrouping.BODY_PAIR) {
label("Connections")
connectionValues {
enum("connectionType", "ConnectionType", listOf("BONDED", "SLIDING"), default = "BONDED")
}
}
}
The structure is fixed; the author declares the binding, the texts and the connection values. Generated models type the field like the compound it is at the JSON level. The field sits at a fixed location (not inside a list or a subtype) and names a declared input, or the build fails. See simulation connections.
Polymorphic compounds¶
A compound field can be polymorphic — multiple shapes per a
discriminator. Currently surfaced via the AbstractCompoundField
base class and the type-checker functions on CompoundValue.
Detailed API is in framework source:
framework/schema/src/main/kotlin/.../elements/AbstractCompoundField.kt
and framework/values/.../CompoundValue.kt.
Empty schemas¶
Every schema-receiving block accepts an empty body:
dataSchema { } // declares an opaque data type (no modeled structure)
configurationSchema { } // for workflows / methods that take no user config
Cross-references¶
- Concepts: schema language.
- Concepts: data types.
- Concepts: measurement units and dimensionals.
- Concepts: entity assignments.
- Reference: ui-configuration entries
— for richer form rendering than the per-field
label/doc. - Reference: validation helpers — for numeric range constraints.