Skip to content

Paraview: MHD Field Lines

Maria Okounkova edited this page Jul 18, 2022 · 2 revisions

Animating magnetic field lines in a moving fluid

This page will guide you through the process of creating animations of magnetic field lines from MHD simulations.

Simulation

In ideal MHD, magnetic field lines are pinned to fluid elements. Therefore, by tracing fluid elements in a hydro simulation, one can seed a specific field line throughout an animation. Here is a rough outline of the input file requirements:

  • Enable evolving fluid tracers, initializing them where you desire field lines
    • (Curran has a script that will generate lots of initial tracers to paste into your input file)
  • Dump Rho0Phys, BPrim, and, if desired, BStrengthGauss. Also dump the tracer positions
    • Dump sufficiently often for smooth animation (for a rotating fluid, use the Nyquist frequency of the fastest rotation speed as a lower bound)
    • (Would BCons be more appropriate, since visualization basically assumes Euclidian geometry?)

Data conversion

After your simulation has run, use ApplyObservers to convert the dumped data to VTK format. Then, transform the VTK-VTS format to VTK-PVTI using Curran's script. This allows much higher quality volumetric rendering and much faster IO, but can only be used for uniform rectilinear grids.

Paraview

Load the PVD file into Paraview, then apply the following filters:

  • Extract subset: (xmin, xmid), (ymin, ymax), (zmin, zmax); name: ExtractSubset1
  • Extract subset: (xmid, xmax), (ymin, ymid), (zmin, zmax); name: ExtractSubset2
  • Colormap script
  • Stream tracer: ...
    • Tube
  • Keyframe script

Animation

Rotate your 3D view until you are satisfied with how it looks (you may want to jump to the last timestep to see how the picture will evolve). Then, select File -> Save screenshot, enter a resolution of 640x480, and save the picture to a temporary location. Open the file and check that the crop is appropriate; if not, zoom in or out in the 3D view and repeat.

Once you've confirmed that the crop is appropriate for a 4:3 aspect ratio, select File -> Save animation, enter a resolution of 2560x1920, and select ".png" as the filetype. This will generate one image for each frame of data.

TODO: Assemble frames into a movie.

Clone this wiki locally