Afivo  0.3
Data Types | Functions/Subroutines | Variables
m_af_output Module Reference

This module contains routines for writing output files with Afivo. The Silo format should probably be used for larger files, especially in 3D. More...

Data Types

interface  subr_add_vars
 
interface  subr_other_data
 

Functions/Subroutines

subroutine, public af_write_tree (tree, filename, write_other_data)
 Write full tree in binary format. More...
 
subroutine, public af_read_tree (tree, filename, read_other_data)
 Read full tree in binary format. More...
 
subroutine, public af_tree_copy_variable (tree_from, ivs_from, tree_to, ivs_to)
 
subroutine, public af_write_line (tree, filename, ivs, r_min, r_max, n_points)
 Write line data in a text file. More...
 
subroutine, public af_write_plane (tree, filename, ivs, r_min, r_max, n_pixels)
 Write data in a plane (2D) to a VTK ASCII file. In 3D, r_min and r_max should have one identical coordinate (i.e., they differ in two coordinates). More...
 
subroutine, public af_write_vtk (tree, filename, n_cycle, time, ixs_cc, add_vars, add_names)
 Write the cell centered data of a tree to a vtk unstructured file. Only the leaves of the tree are used. More...
 
subroutine, public af_write_numpy (tree, filename, r_min, r_max, n_points, n_cycle, time, ixs_cc)
 Write uniform data interpolated from a region to a .npy or .npz numpy file. The format is determined based on the extension of filename. More...
 
subroutine, public af_write_silo (tree, filename, n_cycle, time, ixs_cc, add_vars, add_names, max_lvl)
 Note: a 1D version is present below, and seems to work, but its output cannot be visualized by Visit. That's why we use curve output for 1D cases. More...
 
subroutine, public af_write_silo (tree, filename, n_cycle, time, ixs_cc, add_vars, add_names, add_curve_names, add_curve_dat, max_lvl)
 Write the cell centered data of a tree to a Silo file. Only the leaves of the tree are used. More...
 
subroutine get_output_vars (tree, ix_out)
 

Variables

integer, parameter af_dat_file_version = 3
 

Detailed Description

This module contains routines for writing output files with Afivo. The Silo format should probably be used for larger files, especially in 3D.

Function/Subroutine Documentation

◆ af_write_tree()

subroutine, public m_af_output::af_write_tree ( type(af_t), intent(in)  tree,
character(len=*), intent(in)  filename,
procedure(subr_other_data), optional  write_other_data 
)

Write full tree in binary format.

Parameters
[in]treeTree to write out
[in]filenameFilename for the output

Definition at line 42 of file m_af_output.f90.

◆ af_read_tree()

subroutine, public m_af_output::af_read_tree ( type(af_t), intent(inout)  tree,
character(len=*), intent(in)  filename,
procedure(subr_other_data), optional  read_other_data 
)

Read full tree in binary format.

Parameters
[in,out]treeTree to read in
[in]filenameFilename for the input

Definition at line 198 of file m_af_output.f90.

◆ af_tree_copy_variable()

subroutine, public m_af_output::af_tree_copy_variable ( type(af_t), intent(in)  tree_from,
integer, dimension(:), intent(in)  ivs_from,
type(af_t), intent(inout)  tree_to,
integer, dimension(:), intent(in)  ivs_to 
)
Parameters
[in]tree_fromCopy from this grid
[in]ivs_fromFrom these variable
[in,out]tree_toCopy to this grid
[in]ivs_toTo these variable

Definition at line 377 of file m_af_output.f90.

◆ af_write_line()

subroutine, public m_af_output::af_write_line ( type(af_t), intent(in)  tree,
character(len=*), intent(in)  filename,
integer, dimension(:), intent(in)  ivs,
real(dp), dimension(ndim), intent(in)  r_min,
real(dp), dimension(ndim), intent(in)  r_max,
integer, intent(in)  n_points 
)

Write line data in a text file.

Parameters
[in]treeTree to write out
[in]filenameFilename for the vtk file
[in]ivsVariables to write
[in]r_minMinimum coordinate of line
[in]r_maxMaximum coordinate of line
[in]n_pointsNumber of points along line

Definition at line 408 of file m_af_output.f90.

◆ af_write_plane()

subroutine, public m_af_output::af_write_plane ( type(af_t), intent(in)  tree,
character(len=*), intent(in)  filename,
integer, dimension(:), intent(in)  ivs,
real(dp), dimension(ndim), intent(in)  r_min,
real(dp), dimension(ndim), intent(in)  r_max,
integer, dimension(2), intent(in)  n_pixels 
)

Write data in a plane (2D) to a VTK ASCII file. In 3D, r_min and r_max should have one identical coordinate (i.e., they differ in two coordinates).

Parameters
[in]treeTree to write out
[in]filenameFilename for the vtk file
[in]ivsVariables to write
[in]r_minMinimum coordinate of plane
[in]r_maxMaximum coordinate of plane
[in]n_pixelsNumber of pixels in the plane

Definition at line 466 of file m_af_output.f90.

◆ af_write_vtk()

subroutine, public m_af_output::af_write_vtk ( type(af_t), intent(in)  tree,
character(len=*), intent(in)  filename,
integer, intent(in), optional  n_cycle,
real(dp), intent(in), optional  time,
integer, dimension(:), intent(in), optional  ixs_cc,
procedure(subr_add_vars), optional  add_vars,
character(len=*), dimension(:), intent(in), optional  add_names 
)

Write the cell centered data of a tree to a vtk unstructured file. Only the leaves of the tree are used.

Parameters
[in]treeTree to write out
[in]filenameFilename for the vtk file
[in]n_cycleCycle-number for vtk file (counter)
[in]timeTime for output file
[in]ixs_ccOnly include these cell variables
add_varsOptional routine to add extra variables
[in]add_namesNames of extra variables

Definition at line 557 of file m_af_output.f90.

◆ af_write_numpy()

subroutine, public m_af_output::af_write_numpy ( type(af_t), intent(inout)  tree,
character(len=*), intent(in)  filename,
real(dp), dimension(ndim), intent(in), optional  r_min,
real(dp), dimension(ndim), intent(in), optional  r_max,
integer, dimension(ndim), intent(in), optional  n_points,
integer, intent(in), optional  n_cycle,
real(dp), intent(in), optional  time,
integer, dimension(:), intent(in), optional  ixs_cc 
)

Write uniform data interpolated from a region to a .npy or .npz numpy file. The format is determined based on the extension of filename.

Parameters
[in,out]treeTree to save
[in]filenameFilename, possible extensions: .npz, .npy
[in]n_pointsNumber of points to use
[in]r_minMinimum coordinates
[in]r_maxMaximum coordinates
[in]n_cycleCycle-number (counter)
[in]ixs_ccOnly include these cell variables

Definition at line 757 of file m_af_output.f90.

◆ af_write_silo() [1/2]

subroutine, public m_af_output::af_write_silo ( type(af_t), intent(in)  tree,
character(len=*)  filename,
integer, intent(in), optional  n_cycle,
real(dp), intent(in), optional  time,
integer, dimension(:), intent(in), optional  ixs_cc,
procedure(subr_add_vars), optional  add_vars,
character(len=*), dimension(:), intent(in), optional  add_names,
integer, intent(in), optional  max_lvl 
)

Note: a 1D version is present below, and seems to work, but its output cannot be visualized by Visit. That's why we use curve output for 1D cases.

Parameters
[in]treeTree to write out
filenameFilename for the vtk file
[in]n_cycleCycle-number for vtk file (counter)
[in]timeTime for output file
[in]ixs_ccOnly include these cell variables
add_varsOptional routine to add extra variables
[in]add_namesNames of extra variables
[in]max_lvlMaximum refinement level for output

Definition at line 904 of file m_af_output.f90.

◆ af_write_silo() [2/2]

subroutine, public m_af_output::af_write_silo ( type(af_t), intent(in)  tree,
character(len=*)  filename,
integer, intent(in), optional  n_cycle,
real(dp), intent(in), optional  time,
integer, dimension(:), intent(in), optional  ixs_cc,
procedure(subr_add_vars), optional  add_vars,
character(len=*), dimension(:), intent(in), optional  add_names,
character(len=*), dimension(:), intent(in), optional  add_curve_names,
real(dp), dimension(:, :, :), intent(in), optional  add_curve_dat,
integer, intent(in), optional  max_lvl 
)

Write the cell centered data of a tree to a Silo file. Only the leaves of the tree are used.

Parameters
[in]treeTree to write out
filenameFilename for the vtk file
[in]n_cycleCycle-number for vtk file (counter)
[in]timeTime for output file
[in]ixs_ccOnly include these cell variables
add_varsOptional routine to add extra variables
[in]add_curve_namesNames of extra variables or curves
[in]add_curve_datData for additional curves (#curves, x/y-dimensions, #points)
[in]max_lvlMaximum refinement level for output. Note that the user has to ensure the coarse grid data is up to date

Definition at line 1006 of file m_af_output.f90.

◆ get_output_vars()

subroutine m_af_output::get_output_vars ( type(af_t), intent(in)  tree,
integer, dimension(:), intent(inout), allocatable  ix_out 
)

Definition at line 1583 of file m_af_output.f90.

Variable Documentation

◆ af_dat_file_version

integer, parameter m_af_output::af_dat_file_version = 3
private

Definition at line 11 of file m_af_output.f90.