Skip to main content

Simvue Connectors - ReMKiT-1D


Simvue

Allows simple connection between Simvue and ReMKiT-1D (Reactive Multifluid and Kinetic Transport in 1D), allowing for easy tracking and monitoring of tokamak scrape-off layer simulations in real time.

WebsiteDocumentation

Implementation

A customised RemkitRun class has been created which automatically does the following:

  • Uploads your ReMKiT-1D config file as an input artifact
  • Uploads information from the config file as metadata
  • Tracks the ReMKiT simulation itself, alerting the user via the web UI if the simulation crashes unexpectedly
  • Tracks the outputs from the simulation as they are created, uploading them as 1D, 2D or 3D metrics
  • Uploads all results as output artifacts

The RemkitRun class also inherits from the Run class of the Simvue Python API, allowing for further detailed control over how your simulation is tracked.

Installation

To install and use this connector, first create a virtual environment:

python -m venv venv

Then activate it:

source venv/bin/activate

And then use pip to install this module:

pip install simvue-remkit

Configuration

The server URL and token can be defined as environment variables:

export SIMVUE_URL=...
export SIMVUE_TOKEN=...

or a simvue.toml file can be created containing:

[server]
url = "..."
token = "..."

The exact contents of both of the above options can be obtained directly by clicking the Create new run button on the web UI. Note that the environment variables have preference over the config file.

Usage example

from simvue_remkit.connector import RemkitRun

...

if __name__ == "__main__":

    ...

    # Using a context manager means that the status will be set to completed automatically,
    # and also means that if the code exits with an exception this will be reported to Simvue
    with RemkitRun() as run:

        # Specify a run name, along with any other optional parameters:
        run.init(
          name = 'my-remkit-simulation',                                  # Run name
          metadata = {'simulation_type': 'kinetic_advection'},            # Metadata
          tags = ['remkit', 'advection'],                                 # Tags
          description = 'ReMKiT simulation of tokamak scrape off layer.', # Description
          folder = '/remkit/kinetic-advection/trial_1'                    # Folder path
        )

        # Set folder details if necessary
        run.set_folder_details(
          metadata = {'simulation_type': 'kinetic_advection'},             # Metadata
          tags = ['remkit'],                                               # Tags
          description = 'ReMKiT simulations of tokamak scrape off layers'  # Description
        )

        # Can use the base Simvue Run() methods to upload extra information, eg:
        import os
        run.save_file(os.path.abspath(__file__), "code")

        # Launch the ReMKiT simulation
        run.launch(
            remkit_executable_path='path/to/remkit/executable',  # Path to your ReMKiT executable
            config_path='path/to/my/config_file.json',           # Path to the config file for this simulation
            vars_to_track=['T', 'f'],                            # Optional, specify a set of variables to track
            results_dir_path='path/to/my/results_dir',           # Optional, set a results directory for this run
            clean_results_dir=True                               # Optional, whether to clear pre-existing results before running
            )

You can also use the connector to load in results from previous simulations:

from simvue_remkit.connector import RemkitRun

...

if __name__ == "__main__":

    with RemkitRun() as run:

        # Specify a run name, along with any other optional parameters:
        run.init(
          name = 'my-remkit-simulation',                                  # Run name
          metadata = {'simulation_type': 'kinetic_advection'},            # Metadata
          tags = ['remkit', 'advection'],                                 # Tags
          description = 'ReMKiT simulation of tokamak scrape off layer.', # Description
          folder = '/remkit/kinetic-advection/trial_1'                    # Folder path
        )

        # Can use the base Simvue Run() methods to upload extra information, eg:
        run.save_file(os.path.abspath(__file__), "code")

        # Load from a directory of results from a previous ReMKiT simulation
        run.load(
            results_dir_path='path/to/my/results_dir',  # Path to a directory of results from a ReMKiT simulation
            config_path='path/to/my/config_file.json',  # Optional, path to the config file for this simulation
            vars_to_track=['T', 'f'],                   # Optional, specify a set of variables to track
            )

License

Released under the terms of the GPL-3.0 license.

Citation

To reference Simvue, please use the information outlined in this citation file.

Release files for simvue-remkit 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simvue-remkit 1.0.0
File Size Uploaded
simvue_remkit-1.0.0.tar.gz 18.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simvue-remkit 1.0.0
File Interpreter ABI Platform
simvue_remkit-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.8 kB

Release files / simvue_remkit-1.0.0.tar.gz

Download URL simvue_remkit-1.0.0.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
da356b1d5cbb6ffcc11cdabe7294de11127374957925043e414090257f83b3a1
BLAKE2b-256 checksum
How to use checksums
57318ca09e1ee096816ca973d9ec2ee492f9c5cf8c7da5e800951cd62687fea9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.14

Release files / simvue_remkit-1.0.0-py3-none-any.whl

Download URL simvue_remkit-1.0.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d3145f3855cd8c102010252a51f528ab9419ed87205945b17da3ed11c77d092
BLAKE2b-256 checksum
How to use checksums
b9e6645acde446475001dfd5e59bfc268aab8c2e551e816b395ca85651dd5006
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.14

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page