How It All Works

We hope the examples show some of the benefits of using the CMB platform for simulation workflows, compared to the typical process of writing and organizing input decks by hand. For those wondering how we can apply CMB across many technical disciplines (computational fluid dynamics, heat transfer, high-energy physics, etc.) without developing each application from scratch, the short answer is that we designed CMB’s core software to use the same runtime code across every application. More details about CMB’s core software — called the Simulation Modeling Toolkit (SMTK) — can be found at https://smtk.readthedocs.io. Here is a brief overview of how we put the CMB Wind Tunnel system together.

Note

There are many other CMB/SMTK features that are not covered in this demonstration. If you want to know more, see the documentation at https://smtk.readthedocs.io or contact us at https://www.kitware.com/contact/.

1. Declarative user interface

We designed CMB with the flexibility to generate the user interface at runtime from text file input (XML format). So for this application, we authored text files enumerating the traits (names, types, value ranges, options and so forth) for the relevant OpenFOAM mesh settings, boundary conditions, material models, convergence settings, output options, etc. The file syntax includes a section where we describe how to display the various features and organize them into tabs and other groupings in the user interface. These simulation workflow files are installed with the CMB Wind Tunnel package, so that when the user creates a new project, modelbuilder reads them and produces the user interface you see in the OpenFOAM panel.

2. Attribute Resource

When the user edits the fields in the user interface, we store the data in an internal representation we call an attribute resource. CMB includes software to read and write attribute resources to the file system, so that modelbuilder can populate the user interface at startup and save changes.

3. Python API

To write OpenFOAM input files, we authored Python scripts that are installed with CMB Wind Tunnel. These scripts access the data in the attribute resource using the CMB API. For most CMB software: (i) source code is written in C++ for performance, and (ii) Python bindings are added to each class for script access. Our Python scripts essentially traverse the contents of the attribute resource and, using the values entered by the user, write the OpenFOAM input files.

4. Plugin

In the interest of full disclosure, we also added some custom code to CMB Wind Tunnel in the form of a C++ plugin to provide two features that are not yet available in the standard CMB runtime: (i) the menu for project functions (new, open, save, close) and (ii) the control views that are used in each tab. This was a relatively modest effort to improve usability. If you want to see the plugin source code, it is at https://gitlab.kitware.com/cmb/plugins/openfoam-windtunnel.

Summary

By designing CMB with this flexibility, we can provide a productive preprocessing user interface for a relatively modest development effort. And because CMB is built on top of the ParaView platform, we can easily integrate postprocessing and visualization into the same application. So if you want to create a professional user interface for your simulation code, contact us at https://www.kitware.com/contact/.