# VSim

VSim is a cross-platform computational framework for multi-physics, compatible with Windows, Linux, and macOS.
It includes VSimComposer, a GUI for visual setup of simulations, supporting CAD geometry import and direct geometry construction. VSimComposer allows users to execute data analysis scripts and visualize results in one, two, or three dimensions. VSim utilizes the Vorpal computational engine, which has been applied to simulate electromagnetic systems, plasmas, and rarefied as well as dense gases. VSim is used for modeling basic electromagnetic and plasma physics, complex metallic and dielectric shapes, photonics, vacuum electronics including multipactor effects, laser wake-field acceleration, plasma thrusters, and fusion plasma.
The Vorpal computational engine is a simulation tool designed to operate across one, two, or three-dimensional spaces. It supports computational modes such as the full electromagnetic mode, where it utilizes the Finite-Difference Time-Domain (FDTD) algorithm, and can also work with electrostatic or magneto-static fields.
Particles within Vorpal, whether charged or neutral, can be modeled as a fluid or kinetically using the Particle-in-Cell (PIC) algorithm. The engine ensures these particles interact self-consistently with fields. It can also simulate the interaction of particles and fields with a variety of structures, including conductors, particle absorbers, reflectors, and others, using cut-cell techniques to maintain accuracy.
The computational domain in Vorpal offers flexibility with boundary conditions, supporting periodic domains or boundaries that can simulate an infinite space using Perfectly Matched Layers (PML) or other types of outgoing wave boundary conditions. The output data from Vorpal is in the Hierarchical Data Format (HDF5) and is compliant with VizSchema standards, facilitating further analysis and visualization.

## Input

Simulations can be set up in the VSimComposer setup panel. Shapes can be imported or constructed, materials can be assigned to shapes, fields, and particles can be added, and algorithms can be chosen. VSimComposer then writes out an input file suitable for use by the Vorpal computational engine.
The input file can also be written directly. Here, the user has complete control over the physical quantities to include in the simulation, including low-level control over algorithms and solvers. The user can specify the dynamics of the particles as fully relativistic, non-relativistic, unmagnetized, or other. Additional collisions between electrons, ions, and neutral gases (neutral gases being represented by either fluids or particles) are available in the input file, including self-splitting and self-combining operations. Field ionization can also be included. Advanced surface interactions can be modeled, including user-defined secondary electron emission, sputtering, and surface charging. Parallel decompositioning can also be specified manually for high performance applications.

## Engine execution

VSim can be run from its VSimComposer GUI interface or invoked from the command line. The parallel version of VSim runs on systems that support the Message Passing Interface (MPI). Input to VSim is made via XML-like files used to create simulation objects. A Python-based macro-preprocessor, txpp.py, can be used to generate input files allowing users to set up their simulations with math functions, variable substitutions, macros, and loops.

## Data analysis

Generated data can be analyzed using any of the built-in analyzers, or users can write their own analyzers in any language. Built-in analyzers output data in VizSchema form for immediate visualization in the VSimComposer visualization pane. For analyzers written in Python, VSim provides the VsH5 package, which facilitates writing output in VizSchema.

## Visualization

Vorpal output files can be visualized within VSimComposer. Plots include those for particle data, field data, and simulation geometry, with line-outs for inspecting critical variations. The visualization within VSimComposer is accomplished by embedding the powerful VisIt tool, which users can download for more specific visualizations. Use of the VsH5 package along with popular Python tools like matplotlib allows creation of high-quality publication ready plots.