diff --git a/dev/index.html b/dev/index.html index 03b7ea13..7f51390f 100644 --- a/dev/index.html +++ b/dev/index.html @@ -6,4 +6,4 @@ file = 'test/example.out' data = Batsrus.load(file)

With PyJulia:

from julia import Batsrus
 file = 'test/1d__raw_2_t25.60000_n00000258.out'
-data = Batsrus.load(file)
Python dependency

PyPlot package backend may be affected by the settings of PyJulia dependencies. If you want to set it back properly, you need to recompile the PyCall package in Julia.

Developers

This package inherits the ideas and code structures from its predecessor in IDL (developed by Gábor Tóth) and MATLAB.

Batsrus.jl is developed and maintained by Hongyang Zhou.

Acknowledgments

+data = Batsrus.load(file)
Python dependency

PyPlot package backend may be affected by the settings of PyJulia dependencies. If you want to set it back properly, you need to recompile the PyCall package in Julia.

Developers

This package inherits the ideas and code structures from its predecessor in IDL (developed by Gábor Tóth) and MATLAB.

Batsrus.jl is developed and maintained by Hongyang Zhou.

Acknowledgments

diff --git a/dev/man/examples/index.html b/dev/man/examples/index.html index 0c2d74d0..8a4d31cb 100644 --- a/dev/man/examples/index.html +++ b/dev/man/examples/index.html @@ -101,4 +101,4 @@ x1, z1 = trace2d_eul(bx, bz, xs, zs, x, z, ds=0.1, maxstep=1000, gridType="ndgrid") plot(x1,z1,"--") end -axis("equal")

Currently the select_seeds function uses pseudo random number generator that produces the same seeds every time.

+axis("equal")

Currently the select_seeds function uses pseudo random number generator that produces the same seeds every time.

diff --git a/dev/man/internal/index.html b/dev/man/internal/index.html index c68e7564..b0d6d5a0 100644 --- a/dev/man/internal/index.html +++ b/dev/man/internal/index.html @@ -1,20 +1,20 @@ -Internal · Batsrus.jl

APIs

Public

Types

Functions

Batsrus.convertIDLtoVTKMethod
convertIDLtoVTK(filename; gridType=1, verbose=false)

Convert 3D BATSRUS *.out to VTK. If gridType==1, it converts to the rectilinear grid; if gridType==2, it converts to the structured grid. If filename does not end with "out", it tries to find the ".info" and ".tree" file with the same name tag and generates 3D unstructured VTU file.

source
Batsrus.convertTECtoVTUFunction
convertTECtoVTU(head, data, connectivity, filename="out")

Convert unstructured Tecplot data to VTK. Note that if using voxel type data in VTK, the connectivity sequence is different from Tecplot: the 3D connectivity sequence in Tecplot is the same as the hexahedron type in VTK, but different with the voxel type. The 2D connectivity sequence is the same as the quad type, but different with the pixel type. For example, in 3D the index conversion is:

# PLT to VTK voxel index_ = [1 2 4 3 5 6 8 7]
+Internal · Batsrus.jl

APIs

Public

Types

Functions

Batsrus.convertIDLtoVTKMethod
convertIDLtoVTK(filename; gridType=1, verbose=false)

Convert 3D BATSRUS *.out to VTK. If gridType==1, it converts to the rectilinear grid; if gridType==2, it converts to the structured grid. If filename does not end with "out", it tries to find the ".info" and ".tree" file with the same name tag and generates 3D unstructured VTU file.

source
Batsrus.convertTECtoVTUFunction
convertTECtoVTU(head, data, connectivity, filename="out")

Convert unstructured Tecplot data to VTK. Note that if using voxel type data in VTK, the connectivity sequence is different from Tecplot: the 3D connectivity sequence in Tecplot is the same as the hexahedron type in VTK, but different with the voxel type. The 2D connectivity sequence is the same as the quad type, but different with the pixel type. For example, in 3D the index conversion is:

# PLT to VTK voxel index_ = [1 2 4 3 5 6 8 7]
 for i in 1:2
    connectivity = swaprows!(connectivity, 4*i-1, 4*i)
-end
source
Batsrus.cutdataMethod
cutdata(data, var; plotrange=[-Inf,Inf,-Inf,Inf], dir="x", sequence=1)

Get 2D plane cut in orientation dir for var out of 3D box data within plotrange. The returned 2D data lies in the sequence plane from - to + in dir.

source
Batsrus.cutplotFunction
cutplot(data, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], dir="x", sequence=1,
-   levels=20)

2D plane cut contourf of 3D box data.

source
Batsrus.getdata2dFunction
getdata2d(bd::BATLData, var::AbstractString, plotrange=[-Inf, Inf, -Inf, Inf],
-   plotinterval=Inf; innermask=false)

Return 2D slices of data var from bd. If plotrange is not set, output data resolution is the same as the original. If innermask==true, then the inner boundary cells are set to NaN.

source
Batsrus.getvarMethod
getvars(bd::BATLData, var::AbstractString) -> Array

Return variable data from string var. This is also supported via direct indexing,

Examples

bd["rho"]

See also: getvars.

source
Batsrus.getvarsMethod
getvars(bd::BATLData, Names::Vector) -> Dict

Return variables' data as a dictionary from string vector. See also: getvar.

source
Batsrus.loadMethod
load(filename; npict=1, verbose=false)

Read BATSRUS output files. Stores the npict snapshot from an ascii or binary data file into the arrays of coordinates x and data w.

source
Batsrus.plotdataMethod
plotdata(data, func, args, kwargs...)

Plot the variable from SWMF output.

plotdata(data, "p", plotmode="contbar")

plotdata(data, "p", plotmode="grid")

plotdata(data, func, plotmode="trimesh", plotrange=[-1.0, 1.0, -1.0, 1.0], plotinterval=0.2)

Arguments

  • bd::BATLData: BATSRUS data to be visualized.
  • func::String: variables for plotting.

Keywords

  • plotmode::String: type of plotting ["cont","contbar"]...
  • plotrange::Vector: range of plotting.
  • plotinterval: interval for interpolation.
  • levels: levels of contour.
  • innermask: Bool for masking a circle at the inner boundary.
  • dir: 2D cut plane orientation from 3D outputs ["x","y","z"].
  • sequence: sequence of plane from - to + in that direction.
  • multifigure: 1 for multifigure display, 0 for subplots.
  • verbose: display additional information.
  • density: density for streamlines.
  • stride: quiver strides in number of cells.

Right now this can only deal with 2D plots or 3D cuts. Full 3D plots may be supported in the future.

source
Batsrus.plotlogdataMethod
plotlogdata(data, head, func; plotmode="line")

Plot information from log file.

Input arguments

  • data::Array: output data.
  • head::NamedTuple: header info.
  • func::String: variables for plotting.
  • plotmode::String: type of plotting ["line","scatter"].
source
Batsrus.readtecdataMethod
readtecdata(file; verbose=false)

Return header, data and connectivity from BATSRUS Tecplot outputs. Both 2D and 3D binary and ASCII formats are supported.

Examples

file = "3d_ascii.dat"
-head, data, connectivity = readtecdata(file)
source
Batsrus.streamsliceFunction
streamslice(data::BATLData, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], dir="x",
-   sequence=1; kwargs...)

Plot streamlines on 2D slices of 3D box data. Variable names in var string must be separated with ;.

source
Batsrus.subsurfaceMethod
subsurface(x, y, data, limits)
-subsurface(x, y, u, v, limits)

Extract subset of 2D surface dataset in ndgrid format. See also: subvolume.

source
Batsrus.subvolumeMethod
subvolume(x, y, z, data, limits)
-subvolume(x, y, z, u, v, w, limits)

Extract subset of 3D dataset in ndgrid format. See also: subsurface.

source
PyPlot.contourFunction
contour(data, var, levels=0; ax=nothing, plotrange=[-Inf,Inf,-Inf,Inf],
-   plotinterval=0.1, innermask=false, kwargs...)

Wrapper over contour in matplotlib.

source
PyPlot.contourfFunction
contourf(data, var, levels=0; ax=nothing, plotrange=[-Inf,Inf,-Inf,Inf],
-   plotinterval=0.1, innermask=false, kwargs...)

Wrapper over contourf in matplotlib.

source
PyPlot.pcolormeshFunction
pcolormesh(data, var, levels=0; ax=nothing, plotrange=[-Inf,Inf,-Inf,Inf],
-   plotinterval=0.1, innermask=false, kwargs...)

Wrapper over pcolormesh in matplotlib.

source
PyPlot.plotFunction
plot(data, var, ax=nothing; kwargs...)

Wrapper over plot in matplotlib.

source
PyPlot.plot_surfaceMethod
plot_surface(data, var; plotrange=[-Inf,Inf,-Inf,Inf], plotinterval=0.1,
-   innermask=false, kwargs...)

Wrapper over plot_surface in matplotlib.

source
PyPlot.plot_trisurfFunction
plot_trisurf(data::BATLData, var::String, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf],
-   kwargs...)

Wrapper over plot_trisurf in matplotlib.

source
PyPlot.quiverFunction
quiver(data, var, ax=nothing; stride=10, kwargs...)

Wrapper over quiver in matplotlib. Only supports Cartesian grid for now.

source
PyPlot.scatterFunction
scatter(data, var, ax=nothing; kwargs...)

Wrapper over scatter in matplotlib.

source
PyPlot.streamplotFunction
streamplot(data, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], plotinterval=0.1,
-   kwargs...)

Wrapper over streamplot in matplotlib .

source
PyPlot.tricontourfFunction
tricontourf(data, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], plotinterval=0.1,
-   kwargs...)

Wrapper over tricontourf in matplotlib.

source
PyPlot.tripcolorFunction
tripcolor(data, var, levels=0; ax=nothing, plotrange=[-Inf,Inf,-Inf,Inf],
-   plotinterval=0.1, innermask=false, kwargs...)

Wrapper over tripcolor in matplotlib.

source

Private

Batsrus.create_pvdMethod
create_pvd(filepattern)

Generate PVD file for a time series collection of VTK data.

Example

create_pvd("*.vtu)
source
Batsrus.fillCellNeighbors!Method
fillCellNeighbors!(batl, iCell_G, DiLevelNei_III, iNodeNei_III, nBlock_P)

Fill neighbor cell indexes for the given block. The faces, edges, and vertices are ordered from left (-) to right (+) in x-y-z sequentially.

Vertices: Edges: (10,11 ignored)

7 ––- 8 . –4– .

  • . - . 7 . 8 .

5 ––- 6 . . –3– . 12 . . . . . . . . . 3 ––- 4 9 . –2– . . - . - . 5 . 6 1 ––- 2 . –1– .

Only tested for 3D.

source
Batsrus.find_grid_blockMethod
find_grid_block(batl, xyz_D)

Return processor local block index that contains a point. Input location should be given in Cartesian coordinates.

source
Batsrus.find_tree_nodeMethod
find_tree_node(batl, Coord_D)

Find the node that contains a point. The point coordinates should be given in generalized coordinates normalized by the domain size.

source
Batsrus.getfileheadMethod
getfilehead(fileID::IoStream, filelist::FileList) -> NameTuple

Obtain the header information from BATSRUS output file of type linked to fileID.

Input arguments

  • fileID::IOStream: file identifier.
  • filelist::FileList: file information.
source
Batsrus.order_children!Method
order_children!(batl::Batl, iNode, iMorton::Int, iNodeMorton_I::Vector{Int32})

Recursively apply Morton ordering for nodes below a root block. Store result into iNodeMortonI and iMortonNodeA using the iMorton index.

source
Batsrus.order_treeMethod
order_tree(batl)

Return maximum AMR level in the used block and the Morton curve order. Set iNodeMorton_I indirect index arrays according to

  1. root node order
  2. Morton ordering for each root node
source
Batsrus.setunitsMethod
setunits(filehead, type; distance=1.0, mp=1.0, me=1.0)

Set the units for the output files. If type is given as "SI", "CGS", "NORMALIZED", "PIC", "PLANETARY", "SOLAR", set typeunit = type, otherwise try to guess from the fileheader. Based on typeunit set units for distance [xSI], time [tSI], density [rhoSI], pressure [pSI], magnetic field [bSI] and current density [jSI] in SI units. Distance unit [rplanet | rstar], ion and electron mass in [amu] can be set with optional distance, mp and me.

Also calculate convenient constants ti0, cs0 ... for typical formulas. This function is currently not used anywhere!

source
+end
source
Batsrus.cutdataMethod
cutdata(data, var; plotrange=[-Inf,Inf,-Inf,Inf], dir="x", sequence=1)

Get 2D plane cut in orientation dir for var out of 3D box data within plotrange. The returned 2D data lies in the sequence plane from - to + in dir.

source
Batsrus.cutplotFunction
cutplot(data, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], dir="x", sequence=1,
+   levels=20)

2D plane cut contourf of 3D box data.

source
Batsrus.getdata2dFunction
getdata2d(bd::BATLData, var::AbstractString, plotrange=[-Inf, Inf, -Inf, Inf],
+   plotinterval=Inf; innermask=false)

Return 2D slices of data var from bd. If plotrange is not set, output data resolution is the same as the original. If innermask==true, then the inner boundary cells are set to NaN.

source
Batsrus.getvarMethod
getvars(bd::BATLData, var::AbstractString) -> Array

Return variable data from string var. This is also supported via direct indexing,

Examples

bd["rho"]

See also: getvars.

source
Batsrus.getvarsMethod
getvars(bd::BATLData, Names::Vector) -> Dict

Return variables' data as a dictionary from string vector. See also: getvar.

source
Batsrus.loadMethod
load(filename; npict=1, verbose=false)

Read BATSRUS output files. Stores the npict snapshot from an ascii or binary data file into the arrays of coordinates x and data w.

source
Batsrus.plotdataMethod
plotdata(data, func, args, kwargs...)

Plot the variable from SWMF output.

plotdata(data, "p", plotmode="contbar")

plotdata(data, "p", plotmode="grid")

plotdata(data, func, plotmode="trimesh", plotrange=[-1.0, 1.0, -1.0, 1.0], plotinterval=0.2)

Arguments

  • bd::BATLData: BATSRUS data to be visualized.
  • func::String: variables for plotting.

Keywords

  • plotmode::String: type of plotting ["cont","contbar"]...
  • plotrange::Vector: range of plotting.
  • plotinterval: interval for interpolation.
  • levels: levels of contour.
  • innermask: Bool for masking a circle at the inner boundary.
  • dir: 2D cut plane orientation from 3D outputs ["x","y","z"].
  • sequence: sequence of plane from - to + in that direction.
  • multifigure: 1 for multifigure display, 0 for subplots.
  • verbose: display additional information.
  • density: density for streamlines.
  • stride: quiver strides in number of cells.

Right now this can only deal with 2D plots or 3D cuts. Full 3D plots may be supported in the future.

source
Batsrus.plotlogdataMethod
plotlogdata(data, head, func; plotmode="line")

Plot information from log file.

Input arguments

  • data::Array: output data.
  • head::NamedTuple: header info.
  • func::String: variables for plotting.
  • plotmode::String: type of plotting ["line","scatter"].
source
Batsrus.readtecdataMethod
readtecdata(file; verbose=false)

Return header, data and connectivity from BATSRUS Tecplot outputs. Both 2D and 3D binary and ASCII formats are supported.

Examples

file = "3d_ascii.dat"
+head, data, connectivity = readtecdata(file)
source
Batsrus.streamsliceFunction
streamslice(data::BATLData, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], dir="x",
+   sequence=1; kwargs...)

Plot streamlines on 2D slices of 3D box data. Variable names in var string must be separated with ;.

source
Batsrus.subsurfaceMethod
subsurface(x, y, data, limits)
+subsurface(x, y, u, v, limits)

Extract subset of 2D surface dataset in ndgrid format. See also: subvolume.

source
Batsrus.subvolumeMethod
subvolume(x, y, z, data, limits)
+subvolume(x, y, z, u, v, w, limits)

Extract subset of 3D dataset in ndgrid format. See also: subsurface.

source
PyPlot.contourFunction
contour(data, var, levels=0; ax=nothing, plotrange=[-Inf,Inf,-Inf,Inf],
+   plotinterval=0.1, innermask=false, kwargs...)

Wrapper over contour in matplotlib.

source
PyPlot.contourfFunction
contourf(data, var, levels=0; ax=nothing, plotrange=[-Inf,Inf,-Inf,Inf],
+   plotinterval=0.1, innermask=false, kwargs...)

Wrapper over contourf in matplotlib.

source
PyPlot.pcolormeshFunction
pcolormesh(data, var, levels=0; ax=nothing, plotrange=[-Inf,Inf,-Inf,Inf],
+   plotinterval=0.1, innermask=false, kwargs...)

Wrapper over pcolormesh in matplotlib.

source
PyPlot.plotFunction
plot(data, var, ax=nothing; kwargs...)

Wrapper over plot in matplotlib.

source
PyPlot.plot_surfaceMethod
plot_surface(data, var; plotrange=[-Inf,Inf,-Inf,Inf], plotinterval=0.1,
+   innermask=false, kwargs...)

Wrapper over plot_surface in matplotlib.

source
PyPlot.plot_trisurfFunction
plot_trisurf(data::BATLData, var::String, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf],
+   kwargs...)

Wrapper over plot_trisurf in matplotlib.

source
PyPlot.quiverFunction
quiver(data, var, ax=nothing; stride=10, kwargs...)

Wrapper over quiver in matplotlib. Only supports Cartesian grid for now.

source
PyPlot.scatterFunction
scatter(data, var, ax=nothing; kwargs...)

Wrapper over scatter in matplotlib.

source
PyPlot.streamplotFunction
streamplot(data, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], plotinterval=0.1,
+   kwargs...)

Wrapper over streamplot in matplotlib .

source
PyPlot.tricontourfFunction
tricontourf(data, var, ax=nothing; plotrange=[-Inf,Inf,-Inf,Inf], plotinterval=0.1,
+   kwargs...)

Wrapper over tricontourf in matplotlib.

source
PyPlot.tripcolorFunction
tripcolor(data, var, levels=0; ax=nothing, plotrange=[-Inf,Inf,-Inf,Inf],
+   plotinterval=0.1, innermask=false, kwargs...)

Wrapper over tripcolor in matplotlib.

source

Private

Batsrus.create_pvdMethod
create_pvd(filepattern)

Generate PVD file for a time series collection of VTK data.

Example

create_pvd("*.vtu)
source
Batsrus.fillCellNeighbors!Method
fillCellNeighbors!(batl, iCell_G, DiLevelNei_III, iNodeNei_III, nBlock_P)

Fill neighbor cell indexes for the given block. The faces, edges, and vertices are ordered from left (-) to right (+) in x-y-z sequentially.

Vertices: Edges: (10,11 ignored)

7 ––- 8 . –4– .

  • . - . 7 . 8 .

5 ––- 6 . . –3– . 12 . . . . . . . . . 3 ––- 4 9 . –2– . . - . - . 5 . 6 1 ––- 2 . –1– .

Only tested for 3D.

source
Batsrus.find_grid_blockMethod
find_grid_block(batl, xyz_D)

Return processor local block index that contains a point. Input location should be given in Cartesian coordinates.

source
Batsrus.find_tree_nodeMethod
find_tree_node(batl, Coord_D)

Find the node that contains a point. The point coordinates should be given in generalized coordinates normalized by the domain size.

source
Batsrus.getfileheadMethod
getfilehead(fileID::IoStream, filelist::FileList) -> NameTuple

Obtain the header information from BATSRUS output file of type linked to fileID.

Input arguments

  • fileID::IOStream: file identifier.
  • filelist::FileList: file information.
source
Batsrus.order_children!Method
order_children!(batl::Batl, iNode, iMorton::Int, iNodeMorton_I::Vector{Int32})

Recursively apply Morton ordering for nodes below a root block. Store result into iNodeMortonI and iMortonNodeA using the iMorton index.

source
Batsrus.order_treeMethod
order_tree(batl)

Return maximum AMR level in the used block and the Morton curve order. Set iNodeMorton_I indirect index arrays according to

  1. root node order
  2. Morton ordering for each root node
source
Batsrus.setunitsMethod
setunits(filehead, type; distance=1.0, mp=1.0, me=1.0)

Set the units for the output files. If type is given as "SI", "CGS", "NORMALIZED", "PIC", "PLANETARY", "SOLAR", set typeunit = type, otherwise try to guess from the fileheader. Based on typeunit set units for distance [xSI], time [tSI], density [rhoSI], pressure [pSI], magnetic field [bSI] and current density [jSI] in SI units. Distance unit [rplanet | rstar], ion and electron mass in [amu] can be set with optional distance, mp and me.

Also calculate convenient constants ti0, cs0 ... for typical formulas. This function is currently not used anywhere!

source
diff --git a/dev/man/log/index.html b/dev/man/log/index.html index 4f7bd9bb..c3469969 100644 --- a/dev/man/log/index.html +++ b/dev/man/log/index.html @@ -1,4 +1,4 @@ Log · Batsrus.jl

Development Log

All the workflows here is not restricted to one type of model output. After being familiar with new ideas and new models, one can easily make use of existing samples and create reader of their own. Because of the embarrassing parallelism nature of postprocessing, it is quite easy to take advantage of parallel approaches to process the data.

For the plotting, streamline tracing and particle tracing, a common problem is the grid and related interpolation process. Now I have FieldTracer.jl and TestParticle.jl designed specifically for these tasks.

Test Data

If you don't have SWMF data at hand, Batsrus.jl provides some test data for you to begin with.

using LazyArtifacts
 
-datapath = artifact"testdata" # where you can find multiple test data files

These are also used in the standard test. These will be automatically downloaded from batsrus_data if you run the package test locally.

VTK AMR Grid Structure

vtkOverlappingAMR implements a somewhat strict Berger-Collela AMR scheme:

  1. All grids are Cartesian.
  2. Grids at the same level do not overlap.
  3. The refinement ratios, RL, between adjacent levels are integer (typically 2 or 4) and uniform within the same level.
  4. Grid cells are never partially refined; i.e., each cell is refined to four quads in 2D or eight hexahedra in 3D.

Or in other words,

  • Refinement ratio across levels is constant.
  • Each block at levels > 0 need to be covered 100% by one parent block of

previous level.

  • Some other restriction about what happens at the boundary.

You can directly use vtkUniformGridAMR, which does not impose any restrictions. Most filters should work for this class - there just wouldn't be any specialized filters such as the dual-grid contour / clip ones for the vtkOverlappingAMR.

The vtkAMRInformation documentation consists only of

  • Refinement ratio between AMR levels
  • Grid spacing for each level
  • The file block index for each block parent child information, if requested

sample_2DAMR Sample 2D AMR Dataset with two levels and refinement ratio, RL=4. The root level (L0) consists of a single grid shown in black wireframe while the next level (L1) consists of two grids, depicted in green wireframe and red wireframe respectively. The two grids at L1 are projected from the root level to illustrate that the cells underneath are “hidden.”

In VTK, the collection of AMR grids is stored in a vtkHierarchicalBoxDataSet data-structure. Each grid, G(Li,k), is represented by a vtkUniformGrid data structure where the unique key pair (Li,k) denotes the corresponding level (Li) and the grid index within the level (k) with respect to the underlying hierarchical structure. An array historically known as IBLANK, stored as a cell attribute in vtkUniformGrid, denotes whether a cell is hidden or not. The blanking array is subsequently used by the mapper to hide lower resolution cells accordingly when visualizing the dataset.

To enable the execution of data queries without loading the entire dataset in memory, metadata information is employed. The metadata stores a minimal set of geometric information for each grid in the AMR hierarchy. Specifically, the AMR metadata, B(Li,k), corresponding to the grid G(Li,k), is represented using a vtkAMRBox object and it consists of the following information:

  1. N={Nx, Ny, Nz} — the cell dimensions of the grid (since the data is cell-centered)
  2. The grid spacing at level L, hL={hx,hy,hz}
  3. The grid level Li and grid index k
  4. The global dataset origin, X=(X0, Y0, Z0), i.e., the minimum origin from all grids in level L0
  5. The LoCorner and HiCorner, which describe the low and high corners of the rectangular region covered by the corresponding grid in a virtual integer lattice with the same spacing (h) that covers the entire domain.

sample_2DAMR

Given the metadata information stored in the AMR box of each grid, the refinement ratio at each level can be easily computed using relationship (1) from Table 1. Further, the cartesian bounds the corresponding grid covers and the number of points and cells is also available (see relationships 2-4 in Table 1). Notably, geometric queries such as determining which cell contains a given point, or if a grid intersects a user-supplied slice plane, can be answered using just the metadata.

There is a vtkAMRDualExtractionFilter, which constructs a dual-mesh (i.e., the mesh constructed by connecting the cell-centers) over the computational domain. If we can directly tell ParaView that the mesh we have is a dual-mesh, then the initial trial with multi-block data may work directly.

AMRGaussianPulseSource

See Multi-Resolution Rendering with Overlapping AMR for the implementation of C++ reader in VTK.

+datapath = artifact"testdata" # where you can find multiple test data files

These are also used in the standard test. These will be automatically downloaded from batsrus_data if you run the package test locally.

VTK AMR Grid Structure

vtkOverlappingAMR implements a somewhat strict Berger-Collela AMR scheme:

  1. All grids are Cartesian.
  2. Grids at the same level do not overlap.
  3. The refinement ratios, RL, between adjacent levels are integer (typically 2 or 4) and uniform within the same level.
  4. Grid cells are never partially refined; i.e., each cell is refined to four quads in 2D or eight hexahedra in 3D.

Or in other words,

previous level.

You can directly use vtkUniformGridAMR, which does not impose any restrictions. Most filters should work for this class - there just wouldn't be any specialized filters such as the dual-grid contour / clip ones for the vtkOverlappingAMR.

The vtkAMRInformation documentation consists only of

sample_2DAMR Sample 2D AMR Dataset with two levels and refinement ratio, RL=4. The root level (L0) consists of a single grid shown in black wireframe while the next level (L1) consists of two grids, depicted in green wireframe and red wireframe respectively. The two grids at L1 are projected from the root level to illustrate that the cells underneath are “hidden.”

In VTK, the collection of AMR grids is stored in a vtkHierarchicalBoxDataSet data-structure. Each grid, G(Li,k), is represented by a vtkUniformGrid data structure where the unique key pair (Li,k) denotes the corresponding level (Li) and the grid index within the level (k) with respect to the underlying hierarchical structure. An array historically known as IBLANK, stored as a cell attribute in vtkUniformGrid, denotes whether a cell is hidden or not. The blanking array is subsequently used by the mapper to hide lower resolution cells accordingly when visualizing the dataset.

To enable the execution of data queries without loading the entire dataset in memory, metadata information is employed. The metadata stores a minimal set of geometric information for each grid in the AMR hierarchy. Specifically, the AMR metadata, B(Li,k), corresponding to the grid G(Li,k), is represented using a vtkAMRBox object and it consists of the following information:

  1. N={Nx, Ny, Nz} — the cell dimensions of the grid (since the data is cell-centered)
  2. The grid spacing at level L, hL={hx,hy,hz}
  3. The grid level Li and grid index k
  4. The global dataset origin, X=(X0, Y0, Z0), i.e., the minimum origin from all grids in level L0
  5. The LoCorner and HiCorner, which describe the low and high corners of the rectangular region covered by the corresponding grid in a virtual integer lattice with the same spacing (h) that covers the entire domain.

sample_2DAMR

Given the metadata information stored in the AMR box of each grid, the refinement ratio at each level can be easily computed using relationship (1) from Table 1. Further, the cartesian bounds the corresponding grid covers and the number of points and cells is also available (see relationships 2-4 in Table 1). Notably, geometric queries such as determining which cell contains a given point, or if a grid intersects a user-supplied slice plane, can be answered using just the metadata.

There is a vtkAMRDualExtractionFilter, which constructs a dual-mesh (i.e., the mesh constructed by connecting the cell-centers) over the computational domain. If we can directly tell ParaView that the mesh we have is a dual-mesh, then the initial trial with multi-block data may work directly.

AMRGaussianPulseSource

See Multi-Resolution Rendering with Overlapping AMR for the implementation of C++ reader in VTK.

diff --git a/dev/search/index.html b/dev/search/index.html index 2b919c4f..dec8d6b5 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · Batsrus.jl

Loading search...

    +Search · Batsrus.jl

    Loading search...