Skip to content

Models & data API

MuPIF follows an object-oriented design. Abstract classes define standardized interfaces for models and for data, so all models can be steered through the same generic interface and all data of a given kind can be used in the same way, regardless of where they come from.

One interface for every model

Every simulation code is wrapped as a Model with a common API. Its main methods are initialize, set and get for inputs and outputs, solveStep, finishStep, getCriticalTimeStep and terminate. A workflow is itself a model, so workflows can be nested and reused as building blocks of larger workflows.

The coupled thermo-mechanical workflow below passes the temperature field computed by a thermal model to a mechanical model. The two models may use different meshes and may run on different computers:

class ThermoMechanical(mp.Workflow):

    def solveStep(self, istep, stageID=0, runInBackground=False):
        thermal = self.getModel('thermal')
        mechanical = self.getModel('mechanical')
        thermal.solveStep(istep, stageID, runInBackground)
        # pass the temperature field to the mechanical model
        mechanical.set(thermal.get(mp.DataID.FID_Temperature, istep.getTime()))
        mechanical.solveStep(istep, stageID, runInBackground)

Data types with built-in operations

  • Properties

    Scalar, vector and tensor quantities with units, constant or time dependent.

  • Fields and meshes

    Spatial fields on meshes, with evaluation at any point and interpolation between different discretizations. Fields can be exported to VTK.

  • Heavy structured data

    HeavyStruct stores large hierarchical data (molecules, grains, microstructures) in HDF5, with its structure described by a schema.

  • Physical units

    All quantities carry units, based on astropy. Units are checked and converted automatically when data are passed between models.

  • Files

    PyroFile transfers input and output files between remote models transparently.

  • Time steps

    TimeStep objects synchronize models that use different time discretizations.

Metadata and the core ontology

Models, workflows and data carry metadata validated against JSON schemas. The metadata describe inputs and outputs (type, units, value type), the solver, licences, and the expected accuracy and robustness. They are used for model registries, automatic checks of workflow consistency, code generation in the workflow editor, and for mapping workflow inputs and outputs to the Digital Twin.

MuPIF core ontology

The MuPIF core ontology: models, workflows and data types are MuPIF objects whose metadata are defined by schemas.

Codes already integrated

MuPIF model interfaces (APIs) have been developed for a range of commercial and open-source codes. The list below includes codes integrated by project partners:

Code Domain
COMSOL Multiphysics general multiphysics
Abaqus structural finite element analysis
Digimat multiscale material modelling of composites
ESI VPS virtual performance solution
MICRESS microstructure evolution (phase field)
GTM-X glass furnace CFD
FDS fire dynamics
MUL2 higher-order structural theories

To integrate your own code, implement the Model API in a small Python class. The Model API generator creates a skeleton from the model metadata. See the Model API development tutorial.


(since February, 2023)