BifrostTools.jl

Tools for working with Bifrost in Julia
Author ITA-Solar
Popularity
3 Stars
Updated Last
12 Days Ago
Started In
August 2023

BifrostTools.jl

Dev Build Status Coverage

Tools for reading and working with simulation output from The stellar atmosphere simulation code Bifrost in Julia.

This Julia package is created for working with Bifrost data efficiently. Load single or multiple simulation snapshots, and analyse data with Julia speed.

This package is an extension of Bifrost.jl, a script written by Mikolaj Szydlarski.

Documentation

The documentation is available at https://ita-solar.github.io/BifrostTools.jl

Quick user guide

To install the package, open julia and add it in the package manager (the package manager is opened by typing ])

] add BifrostTools

To load the package, type the following in the REPL

using BifrostTools

Using get_var

The function get_var is the main function for reading data from Bifrost simulations. It can read single or multiple snapshots, and it can read full data cubes or slices. It can read primary variables or auxiliary variables.

The command

variable = get_var(expname, snap, expdir, variable)

loads the (primary or auxiliary) variable variable from snapshot snap in the simulation expname located in the directory expdir.

By creating a BifrostExperiment object

brxp = BifrostExperiment(expname, expdir)

we can access the mesh file

brxp.mesh

snapshot numbers

brxp.snaps

and the calling signature of get_var can be simplified

variable = get_var(brxp, snap, variable)

Using optional keyword-arguments in get_var allows us to convert units, destagger variables, rotate the grid, and read slices of the full cube.

The command

bx = get_var(brxp, snap, "bx"; units="si", destagger=true)

will load the $x$-component of the magnetic field in SI units and destagger it to the cell center.

See the documentation for further information and more elaborate example usage.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md