Skip to content

Methods

A method is a callable, configurable unit of computation invoked from a workflow. Where a data type is what data looks like, a method is what to do with it: meshing, solving, optimization, parametric runs, custom analyses. A workflow type composes methods (plus inline operations and nested workflows) into a graph.

Anatomy of a .method.kts

method {
    dependencies {
        // dataType / method / workflowType dependencies, e.g.
        // dataType("data-type:ref:1.0.0")
    }

    metadata {
        reference = "group:id:version"
        name = "…"
        description = "…"
    }

    dataInterface {
        // input("inputName", "data-type:ref:1.0.0") { … }
        // output("outputName", "data-type:ref:1.0.0") { … }
    }

    configurationSchema {
        // user-tunable parameters using the schema description language
    }

    executable {
        imageName = "registry.example.com/my-team/<method>"
        imageTag = "latest"
        executableName = "<method>"
    }

    codeGeneration { language = "python" }

    // Optional:
    // validationRuleSet  { /* return a ValidationRuleSet */ }
    // resourceEstimation { /* return a MethodResourceEstimationValueModel */ }
}

Required: dependencies (can be empty), metadata, dataInterface (can be empty), configurationSchema (can be empty), executable.

Data interface

The data interface declares the method's named inputs and outputs, each typed by a data type:

dataInterface {
    input("geometry", "simscale.test:mock-geometry:1.0.0") {
        label("Geometry")
        doc("Geometry to mesh")
    }

    output("mesh", "simscale.test:mock-mesh:1.0.0") {
        label("Mesh")
    }
}

Inputs flow in from the workflow's wiring; outputs flow out for downstream operations to consume. The data-type:ref:1.0.0 references must appear in dependencies { }.

Configuration schema

User-tunable parameters declared in the schema description language — the same DSL used in data types' dataSchema { } and in workflow types' configurationSchema { }. Typical fields: integers, reals, enums, dimensional scalars, references to other config data types.

configurationSchema {
    integer("maxIterations", default = 100) {
        label("Maximum iterations")
    }
    enum("strategy", "Strategy", listOf("FAST", "ACCURATE"), default = "ACCURATE") {
        label("Strategy")
    }
    length("convergenceThreshold", default = 0.001.meter) {
        label("Convergence threshold")
    }
}

The runtime configDataModel is what the method's executable receives when invoked — see "Executable contract" below.

Executable

executable {
    imageName = "registry.example.com/my-team/my-method"
    imageTag = "latest"
    executableName = "my-method"
}

Three fields: - imageName — Docker image registry URL of the method's runtime. - imageTag — image tag (typically latest for snapshots, a version-pinned tag for releases). - executableName — the binary entry point inside the image.

The platform spins up the image and invokes the executable on each method-call operation. As a method developer, this is your "where the work runs" declaration; the binary is your responsibility (in a separate, native-side build), simkit ignores the actual code.

A method's component directory may contain native-side artifacts alongside the .kts (a Dockerfile, Python sources, pyproject.toml, etc.). simkit doesn't touch them — executable.imageName points at a pre-built image elsewhere.

Code generation

    codeGeneration { language = "python" }

The codeGeneration section has a single field, language. This is the language in which you intend to write your method. Specifying a code generation language will trigger generation of data classes based on the method's dataInterface and configurationSchema. The classes are generated during the build process.

python, go, rust, and kotlin are currently available choices.

Validation rules, UI configuration and resource estimation

Three optional blocks, each with configValueModel (the typed view of configurationSchema) in scope:

  • validationRuleSet { ... } — returns a ValidationRuleSet that validates a method configuration before the method runs. Cases evaluate against configValueModel and emit errors / warnings. See validation-rules.md.
  • uiConfiguration { ... } — returns a UiConfiguration describing how the method configuration is presented, with the same entries a workflow type uses. A method configuration is not edited by end users: the workflow type's configuration is, and the workflow definition maps it onto the method. Clients present the method configuration instead — SimScale Workbench in the details of an operation run, the SimKit Web UI on the method page — so the presentation entries are the ones that apply: navigation and list navigation, titles, visibility, plots and custom compound UIs. Editing entries such as sliders and geometry derivations are accepted but have no effect on a read-only view. See UI configuration entries.
  • resourceEstimation { ... } — returns a MethodResourceEstimationValueModel that declares how the method's CPU / memory / wall-clock cost depends on its configuration. The platform uses it for scheduling and cost reporting.

Native vs inline

A method runs an external executable. If you only need to compute something simple — value-model arithmetic over inputs, a scalar transform, a small selector — you don't need a method at all. Use an inline operation inside the workflow definition instead. See methods-vs-inline-vs-nested.md for when to choose which.

Check method interface for more information on how to write the executable.

Generated DSL surface for consumers

When a workflow type depends on a method, a set of extension functions is auto-generated:

  • A method-call function in workflowDefinition { }. Naming: camelCase id. Method simscale.test:native-test:1.0.0 → function nativeTest(...). Named arguments mirror the method's outputs; the trailing lambda body assigns workflow config to method config:
workflowDefinition {
    nativeTest(
        solverLog = solverLog,
    ) {
        executionControl = configValueModel.execution
        solverLog = configValueModel.solverLogConfig
    }
}
  • A *OperationContainer extension for each control-flow group, so methods can be invoked inside parametric / conditional / group operations.

The function signatures are concrete enough that an editor's auto-complete shows you the right shape — no need to remember the data interface by hand.

Live example

simscale.test:native-test:1.0.0 is the canonical public test method. Inspect it via simkit component show simscale.test:native-test:1.0.0. The first-workflow-type tutorial walks through wrapping it.

Cross-references