Skip to content

mungerct/VisIt_Scripts_Alamo

Repository files navigation

Overview

This git repo provides a framework to use VisIt to analyse the results of scientific simulations in a reproducible and systemic way. Currently there are 2 main functionalities of the repo, "high variable plotting" and making gifs. The high variable plotting is meant to collapse a 3 dimensional simulations (2 length axis and 1 time axis) into a 2d image, removing the time dimension to be used in publications. This can be used to see the highest temperature at each cell over the course of a simulation (see example below) or to find where the highest stress in a simulated domain occurs at. The make gifs section of the repo makes a gif to be used in presentations of your data. Both of these options use .txt files as input files (see sample inputs below) and a metadata file with all parameters and the git hash is saved after every image/gif is made. This is meant to make all figures reproducible, speeding up research so if you forget how you made an image, the metadata will allow you to remake it. Below is a summary of the "high_var.sh" and "make_gif.sh" shell scripts that are used to run this code.

High Variable Plotting

This section describes the high_var.sh tool

High Variable Plotting

To use this feature, the high_var.mode = space must be specificed in the input deck. This mode "spacially" adds a value and takes the highest value at each spacial point over time. This code produces a compiled image the highest variable over all timesteps, the example image below shows how temperature timesteps can be combined to visualize where the highest temperature in a given simulation is over all time.

Make High Temp Plot Example

The code saves images at all specified timesteps, and then overlays them and compares their values, the larger of the two values is kept so only the higher temperature is shown in the result. The input file used to make the above image is provided below as an example.

Sample Script

file.default_db: celloutput.visit
file.output_filename: make_high_temp_fig_composite
step.interval: 10
step.start: 20
step.end: 51
plotting.main_plotting_var.name: temp
plotting.main_plotting_var.colormap: hot
plotting.main_plotting_var.min: 700
plotting.main_plotting_var.max: 1200
plotting.main_plotting_var.thresholding.on: 1
plotting.main_plotting_var.thresholding.var.name: eta
plotting.main_plotting_var.thresholding.var.min: 0.5
plotting.main_plotting_var.thresholding.var.max: 1e+37
plotting.background_var.on: 1
plotting.background_var.name: eta
plotting.background_var.invert: 0
plotting.background_var.colormap: gray
plotting.legend.name.on: 1
plotting.legend.name.text: Temp (K)
plotting.legend.name.position.x: -1150
plotting.legend.name.position.y: -800
plotting.legend.name.dpi: 500
plotting.legend.name.fontsize: 4

This file was run using the following command

~/path/to/VisIt_Scripts_Alamo/high_var.sh /path/to/input/file/input.txt

To use this feature, the high_var.mode = time must be specificed in the input deck. This "temporally" adds all of the plots togeather, taking the points from larger time values at each spacial point. The example below is from the burning of a propellant, and the "burn front" can be seen as time increases. The different colors coorspond to the edge of the burned region at each time value. Make eta_reg Example

Sample Script

file.db_path: /research/papers/RegressionWithVoidsFullFeedback/results/arbitary_geometry_tests/output.arbitary_geo.phi_fake_grain
file.default_db: celloutput.visit
file.output_filename: eta_reg
file.width: 1080
file.height: 1080
step.interval: 10
step.start: 0
step.end: 151
plotting.main_plotting_var.name: eta
plotting.main_plotting_var.colormap: plasma
plotting.main_plotting_var.min: 0
plotting.main_plotting_var.max: 1
plotting.main_plotting_var.thresholding.on: 1
plotting.main_plotting_var.thresholding.var.name: eta
plotting.main_plotting_var.thresholding.var.min: 0.5
plotting.main_plotting_var.thresholding.var.max: 1
plotting.background_var.on: 1
plotting.background_var.name: eta
plotting.background_var.invert: 0
plotting.background_var.colormap: gray
plotting.contour.on: 1
plotting.contour.var.name: phi
plotting.contour.values: (0.25, 0.5, 0.75)
plotting.contour.linewidth: 1
plotting.contour.color: (0, 0, 0, 255)
plotting.legend.on: 1
plotting.legend.position: bottom
plotting.legend.name.on: 1
plotting.legend.name.text: Time (s)
plotting.legend.name.fontsize: 8
sim.time.arr: [0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75]
high_var.mode: time

Configuration Details

Database Settings

Parameter Default Description
file.db_path os.getcwd() Path to database directory
file.default_db "celloutput.visit" Default database filename
file.height "1080" Output image height in pixels
file.output_filename "high_var_all_time" Output file name for generated visualizations
file.width "1080" Output image width in pixels

Gif Images

Parameter Default Description
gif_images.filetype "gif" Output file type of gif images script, supported file types are .gif "gif" and Web M "webm"
gif_images.fps "10" Frames per second (fps) of the completed gif
gif_images.mode "movie" Makes a move/gif of from the output images, other option is "grid", where the frames are placed in a grid

Grid

Parameter Default Description
gif_images.grid.ncols "4" Number of columns in the output grid (number of rows is based on number of columns)
gif_images.grid.padding "50" padding (in pixels) of the space between images in the grid mode

Webm

Parameter Default Description
gif_images.webm.quality "16" Quality of the completed Web M file, (0 lossless, 63 lowest quality), controls the imageio "-crf" parameter

High Var

Parameter Default Description
high_var.mode "space" The 2 different modes for the high_var.sh script, see the high var section for details, the two options are time and space

Plotting Configuration (Variables, legend, location, etc.)

Background Img

Parameter Default Description
plotting.background_img.name "path/to/img/img.png" Path to background image
plotting.background_img.on "0" Enable a background image instead of a background variable

Background Var

Parameter Default Description
plotting.background_var.colormap "gray" Background colormap
plotting.background_var.invert "0" Invert background colors (0=off, 1=on)
plotting.background_var.name "eta" Background variable name
plotting.background_var.on "0" Enable background variable (0=off, 1=on)

Contour

Parameter Default Description
plotting.contour.color (0, 0, 0, 255) Contour color (RGBA) (default: black)
plotting.contour.linewidth "2" Contour line width
plotting.contour.on "0" Enable contour lines (0=off, 1=on)
plotting.contour.values "0.5" Contour value(s)
Var
Parameter Default Description
plotting.contour.var.name "phi" Variable to contour

Legend

Parameter Default Description
plotting.legend.on "0" Enable legend (0=off, 1=on)
plotting.legend.position "right" Legend X position (left/right/top/bottom)
Name
Parameter Default Description
plotting.legend.name.fontsize "8" Legend font size
plotting.legend.name.on "0" Enable legend name/label (0=off, 1=on)
plotting.legend.name.text "Good Legend" Legend text
Ticks
Parameter Default Description
plotting.legend.ticks.fontsize "10" fontsize of the ticks in the colorbar
plotting.legend.ticks.numticks "5" Number of ticks in the colorbar

Main Plotting Var

Parameter Default Description
plotting.main_plotting_var.colormap "plasma" Colormap for visualization, see available colormaps section for support VisIt colormaps
plotting.main_plotting_var.max "2000" Maximum value for color scale
plotting.main_plotting_var.min "0" Minimum value for color scale
plotting.main_plotting_var.name "temp" Variable to plot
Define Scalar Expression
Parameter Default Description
plotting.main_plotting_var.define_scalar_expression.expression "expression_here" Mathematical expression definition
plotting.main_plotting_var.define_scalar_expression.name "expression_name" Name for the expression
plotting.main_plotting_var.define_scalar_expression.on "0" Enable custom scalar expression (0=off, 1=on)
Thresholding
Parameter Default Description
plotting.main_plotting_var.thresholding.on "0" Enable thresholding (0=off, 1=on)
Var
Parameter Default Description
plotting.main_plotting_var.thresholding.var.max "1e37" Maximum threshold value
plotting.main_plotting_var.thresholding.var.min "0.0" Minimum threshold value
plotting.main_plotting_var.thresholding.var.name "eta" Variable to threshold by

Data Transfer, not for input use

Parameter Default Description
sim.type "0" not a user input, used to transfer data between scripts (used to tell if high_var vs gif_images was used)

Time

Parameter Default Description
sim.time.arr "0" not a user input, used to transfer data between scripts, will get overwritten if included in input file

Step Control

Parameter Default Description
step.end "-1" Ending timestep (-1 = all timesteps)
step.interval "1" Interval between timesteps
step.start "0" Starting timestep

Available Colormaps

The following colormaps are supported for visualization:

Sequential Colormaps

  • viridis
  • plasma
  • magma
  • inferno
  • cividis
  • turbo
  • hot

Grayscale

  • gray

Single Hue Sequential

  • blues
  • Greens
  • Oranges
  • Purples
  • Reds

Multi-Hue Sequential

  • BuGn
  • GnBu
  • PuBu
  • PuBuGn
  • OrRd
  • PuRd
  • RdPu
  • YlgGn
  • YlGnBu
  • YlOrBr
  • YlOrRd

Diverging Colormaps

  • PRGn
  • PiYG
  • PuOr
  • RdBu
  • RdGy
  • RdYlBu
  • RdYlGn
  • Spectral

Qualitative Colormaps

  • rainbow
  • Dark2
  • Paired
  • Set1

Notes

  • Boolean parameters use 0 for off/disabled and 1 for on/enabled
  • Color values are specified as RGBA tuples with values 0-255
  • Use -1 for step.end to process all available timesteps

About

Repo for VisIt scripts when working with Alamo

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages