|
2 | 2 |
|
3 | 3 | # Flow visualization |
4 | 4 |
|
5 | | -A post-processed database in Silo-HDF5 format can be visualized and analyzed using Paraview and VisIt. |
6 | | -After the post-processing of simulation data (see section @ref running "Running"), a directory named `silo_hdf5` contains a silo-HDF5 database. |
7 | | -Here, `silo_hdf5/` includes a directory named `root/` that contains index files for flow field data at each saved time step. |
| 5 | +After running `post_process` on a simulation (see @ref running "Running"), MFC produces output in either Silo-HDF5 format (`format=1`) or binary format (`format=2`). |
| 6 | +These can be visualized using MFC's built-in CLI tool or external tools like ParaView and VisIt. |
8 | 7 |
|
9 | | -### Visualizing with Paraview |
| 8 | +--- |
10 | 9 |
|
11 | | -Paraview is an open-source interactive parallel visualization and graphical analysis tool for viewing scientific data. |
| 10 | +## Quick visualization with `./mfc.sh viz` |
| 11 | + |
| 12 | +MFC includes a built-in visualization command that renders PNG images and MP4 videos directly from post-processed output — no external GUI tools needed. |
| 13 | + |
| 14 | +### Basic usage |
| 15 | + |
| 16 | +```bash |
| 17 | +# Plot pressure at timestep 1000 |
| 18 | +./mfc.sh viz case_dir/ --var pres --step 1000 |
| 19 | + |
| 20 | +# Plot density at all available timesteps |
| 21 | +./mfc.sh viz case_dir/ --var rho --step all |
| 22 | +``` |
| 23 | + |
| 24 | +The command auto-detects the output format (binary or Silo-HDF5) and dimensionality (1D, 2D, or 3D). |
| 25 | +Output images are saved to `case_dir/viz/` by default. |
| 26 | + |
| 27 | +### Exploring available data |
| 28 | + |
| 29 | +Before plotting, you can inspect what data is available: |
| 30 | + |
| 31 | +```bash |
| 32 | +# List all available timesteps |
| 33 | +./mfc.sh viz case_dir/ --list-steps |
| 34 | + |
| 35 | +# List all available variables at a given timestep |
| 36 | +./mfc.sh viz case_dir/ --list-vars --step 0 |
| 37 | +``` |
| 38 | + |
| 39 | +### Timestep selection |
| 40 | + |
| 41 | +The `--step` argument accepts several formats: |
| 42 | + |
| 43 | +| Format | Example | Description | |
| 44 | +|--------|---------|-------------| |
| 45 | +| Single | `--step 1000` | One timestep | |
| 46 | +| Range | `--step 0:10000:500` | Start:end:stride | |
| 47 | +| All | `--step all` | Every available timestep | |
| 48 | + |
| 49 | +### Rendering options |
| 50 | + |
| 51 | +Customize the appearance of plots: |
| 52 | + |
| 53 | +```bash |
| 54 | +# Custom colormap and color range |
| 55 | +./mfc.sh viz case_dir/ --var rho --step 1000 --cmap RdBu --vmin 0.5 --vmax 2.0 |
| 56 | + |
| 57 | +# Higher resolution |
| 58 | +./mfc.sh viz case_dir/ --var pres --step 500 --dpi 300 |
| 59 | + |
| 60 | +# Logarithmic color scale |
| 61 | +./mfc.sh viz case_dir/ --var schlieren --step 1000 --log-scale |
| 62 | +``` |
| 63 | + |
| 64 | +| Option | Description | Default | |
| 65 | +|--------|-------------|---------| |
| 66 | +| `--cmap` | Matplotlib colormap name | `viridis` | |
| 67 | +| `--vmin` | Minimum color scale value | auto | |
| 68 | +| `--vmax` | Maximum color scale value | auto | |
| 69 | +| `--dpi` | Image resolution (dots per inch) | 150 | |
| 70 | +| `--log-scale` | Use logarithmic color scale | off | |
| 71 | +| `--output` | Output directory for images | `case_dir/viz/` | |
| 72 | + |
| 73 | +### 3D slicing |
| 74 | + |
| 75 | +For 3D simulations, `viz` extracts a 2D slice for plotting. |
| 76 | +By default, it slices at the midplane along the z-axis: |
| 77 | + |
| 78 | +```bash |
| 79 | +# Default z-midplane slice |
| 80 | +./mfc.sh viz case_dir/ --var pres --step 500 |
| 81 | + |
| 82 | +# Slice along the x-axis at x=0.25 |
| 83 | +./mfc.sh viz case_dir/ --var pres --step 500 --slice-axis x --slice-value 0.25 |
| 84 | + |
| 85 | +# Slice by array index |
| 86 | +./mfc.sh viz case_dir/ --var pres --step 500 --slice-axis y --slice-index 50 |
| 87 | +``` |
| 88 | + |
| 89 | +### Video generation |
| 90 | + |
| 91 | +Generate MP4 videos from a range of timesteps: |
| 92 | + |
| 93 | +```bash |
| 94 | +# Basic video (10 fps) |
| 95 | +./mfc.sh viz case_dir/ --var pres --step 0:10000:100 --mp4 |
| 96 | + |
| 97 | +# Custom frame rate |
| 98 | +./mfc.sh viz case_dir/ --var schlieren --step all --mp4 --fps 24 |
| 99 | + |
| 100 | +# Video with fixed color range |
| 101 | +./mfc.sh viz case_dir/ --var rho --step 0:5000:50 --mp4 --vmin 0.1 --vmax 1.0 |
| 102 | +``` |
| 103 | + |
| 104 | +Videos are saved as `case_dir/viz/<varname>.mp4`. |
| 105 | +The color range is automatically computed from the first, middle, and last frames unless `--vmin`/`--vmax` are specified. |
| 106 | + |
| 107 | +### Format selection |
| 108 | + |
| 109 | +The output format is auto-detected from the case directory. |
| 110 | +To override: |
| 111 | + |
| 112 | +```bash |
| 113 | +./mfc.sh viz case_dir/ --var pres --step 0 --format binary |
| 114 | +./mfc.sh viz case_dir/ --var pres --step 0 --format silo |
| 115 | +``` |
| 116 | + |
| 117 | +> [!NOTE] |
| 118 | +> Reading Silo-HDF5 files requires the `h5py` Python package. |
| 119 | +> If it is not installed, you will see a clear error message with installation instructions. |
| 120 | +> Alternatively, use `format=2` (binary) in your case file to produce binary output, which has no extra dependencies. |
| 121 | +
|
| 122 | +### Complete option reference |
| 123 | + |
| 124 | +Run `./mfc.sh viz -h` for a full list of options. |
| 125 | + |
| 126 | +--- |
| 127 | + |
| 128 | +## Visualizing with ParaView |
| 129 | + |
| 130 | +ParaView is an open-source interactive parallel visualization and graphical analysis tool for viewing scientific data. |
| 131 | +Post-processed data in Silo-HDF5 format (`format=1`) can be opened directly in ParaView. |
12 | 132 | Paraview 5.11.0 has been confirmed to work with the MFC databases for some parallel environments. |
13 | 133 | Nevertheless, the installation and configuration of Paraview can be environment-dependent and are left to the user. |
14 | 134 |
|
|
0 commit comments