SLICE OUTPUT
To alleviate the disk space requirements and overhead of full snapshot output, it is possible to write hypersurfaces at their own (short) intervals. Currently, these slices are aligned with the grid, with the benefit that only a sub-space of the forest has to be traversed to obtain a Morton ordered AMR-aware subgrid. The slice output is useful especially in expensive 3D simulations in cartesian geometry, but gives valid output for any dimension and geometry. The output is composed of the grid cells closest to the specified subdimensional plane and thus reflects non-interpolated simulation variables which can be handy for debugging purposes.
This page:
[Setup in par file] [Slicing of existing output] [Usage for visualization]
Setup in par file
D-1 dimensional slices are the third file format with output intervals that can be specified in the savelist section of the par file. To give an example, here we specify three slices, where the first is perpendicular to the first coordinate direction (slicedir(1)=1) and intersects the first axis at a value of 0.6 (slicecoord(1)=0.6). The second plane is parametrized perpendicular to the third coordinate direction (slicedir(2)=3) and intersects the third axis at a value of 0.8 (slicecoord(2)=0.8) and analoge for the third slice.
&savelist
itsave(1,3)=0
dtsave(3)=0.1d0
nslices=3
slicedir(1)=1
slicecoord(1)=0.6
slicedir(2)=3
slicecoord(2)=0.8
slicedir(3)=2
slicecoord(3)=0.7
/
The total number of slices is specified by nslices.
The implementation obtains a properly Morton ordered subdimensional forest with the same levels as the original simulation, such that the output can even be used for restarts in lower dimension.
In the standard configuration, BHAC will output cell-centered *.vtu files. In addition, you can select the format of the dump-files *.dat (for sub-dimensional re-starts) and ascii *.csv files.
This is controlled in the filelist:
&filelist
slice_type = 'vtuCC' | 'vtu' | 'dat' | 'csv'
/
This means in order: cell-centered vtu files, point-wise vtu files, native dump-files and ascii csv-files.
The output filename is composed of the direction and offset values. For example, the first slice output name reads filenameout-d1-x0.6D00-nXXXX.dat and analoge for the other two slices.
Note, that the order of the (reduced) dimensions in the resulting output files is preserved, e.g. the third slice in the example above will hold the x-direction as first coordinate and the z-direction as second coordinate. This should be kept in mind for setting up the par file for the convert-step and also for subsequent visualization.
To slice existing full snapshot *.dat files, the simulation can be restarted from a given output time and the code can be brought to a halt after zero iterations. This is done in the following way: its best to create a new *.par file (e.g. slices.par) and clear the savelist from any output to filetypes other than 3. We use itsave to demand a slice output for the zero-iteration.
&savelist
itsave(1,3)=0
nslices=3
slicedir(1)=1
slicecoord(1)=0.6
slicedir(2)=3
slicecoord(2)=0.8
slicedir(3)=2
slicecoord(3)=0.7
/
The stoplist should look like the following,
&stoplist
itreset=.true.
itmax=0
/
where we reset the iteration counter (so that itsave(1,3)=0 will output slice data) and stop the code immediately after the IO (itmax=0).
The code can then be started with
./bhac -restart 10 -i slices.par -slice 10 -if output/data
which will take the output output/data0010.dat (-restart 10, -if output/data) to create new slices with index 10 (-slice 10). The par-file is the newly created slices.par (-i slices.par) so that the default used to run the code can be left untouched. It is a simple exercise in shell scripting to run along all output-files in one go. For example with the BASH:
for i in {0..10}; do ./bhac -restart $i -i slices.par -slice $i -if output/data; done
All coordinates have been converted to a (pseudo-) cartesian system, so you can directly import the slices in e.g. Paraview and they should be oriented correctly. If you use the amrplot Python tools, make sure to rotate the slice to the x-y plane upon importing, this can be done with the rotateX parameter of the read.load class. E.g.
import read,amrplot
d = read.load(100,file='output/data-d3-x0.0D00-n',rotateX=-90)
for a run in spherical coordinates where the third direction is phi and hence the slice is originally in the x-z plane.