MPI-AMRVAC  2.2
The MPI - Adaptive Mesh Refinement - Versatile Advection Code
Functions/Subroutines | Variables
mod_input_output Module Reference

Module for reading input and writing output. More...

Functions/Subroutines

subroutine read_arguments ()
 Read the command line arguments passed to amrvac. More...
 
subroutine read_par_files ()
 Read in the user-supplied parameter-file. More...
 
subroutine get_fields_string (line, delims, n_max, fields, n_found, fully_read)
 Routine to find entries in a string. More...
 
subroutine saveamrfile (ifile)
 
subroutine create_output_file (fh, ix, extension, suffix)
 Standard method for creating a new output file. More...
 
logical function snapshot_exists (ix)
 
integer function get_snapshot_index (filename)
 
subroutine snapshot_write_header (fh, offset_tree, offset_block)
 Write header for a snapshot. More...
 
subroutine snapshot_read_header (fh, offset_tree, offset_block)
 Read header for a snapshot. More...
 
pure integer function count_ix (ixOL)
 Compute number of elements in index range. More...
 
subroutine block_shape_io (igrid, n_ghost, ixOL, n_values)
 Determine the shape of a block for output (whether to include ghost cells, and on which sides) More...
 
subroutine write_snapshot
 
subroutine read_snapshot
 Routine to read in snapshots (.dat files). When it cannot recognize the file version, it will automatically try the 'old' reader. More...
 
subroutine read_snapshot_old ()
 
subroutine printlog_default
 Write volume-averaged values and other information to the log file. More...
 
subroutine printlog_regression_test ()
 Print a log that can be used to check whether the code still produces the same output (regression test) More...
 
subroutine get_volume_average (power, mode, volume)
 Compute mean(w**power) over the leaves of the grid. The first mode (power=1) corresponds to the mean, the second to the mean squared values and so on. More...
 
subroutine get_volume_coverage (vol_cov)
 Compute how much of the domain is covered by each grid level. This routine does not take a non-Cartesian geometry into account. More...
 
subroutine get_volume_average_func (func, f_avg, volume)
 Compute the volume average of func(w) over the leaves of the grid. More...
 
subroutine get_global_maxima (wmax)
 Compute global maxima of iw variables over the leaves of the grid. More...
 
subroutine get_global_minima (wmin)
 Compute global minima of iw variables over the leaves of the grid. More...
 

Variables

integer, parameter version_number = 5
 Version number of the .dat file output. More...
 
integer, dimension(3), parameter compatible_versions = [3, 4, 5]
 List of compatible versions. More...
 
integer nw_found
 number of w found in dat files More...
 
character(len= *), parameter fmt_r = 'es16.8'
 
character(len= *), parameter fmt_r2 = 'es10.2'
 
character(len= *), parameter fmt_i = 'i8'
 

Detailed Description

Module for reading input and writing output.

Function/Subroutine Documentation

◆ block_shape_io()

subroutine mod_input_output::block_shape_io ( integer, intent(in)  igrid,
integer, dimension(2*ndim), intent(out)  n_ghost,
integer, intent(out)  ixO,
integer, intent(out)  L,
integer, intent(out)  n_values 
)

Determine the shape of a block for output (whether to include ghost cells, and on which sides)

Parameters
[out]n_ghostnghost(1:ndim) contains the number of ghost cells on the block's minimum boundaries, and nghost(ndim+1:2*ndim) on the block's maximum boundaries
[out]ixoIndex range on output block
[out]lIndex range on output block
[out]n_valuesNumber of cells/values in output

Definition at line 1459 of file mod_input_output.t.

Here is the call graph for this function:

◆ count_ix()

pure integer function mod_input_output::count_ix ( integer, intent(in)  ixO,
integer, intent(in)  L 
)

Compute number of elements in index range.

Definition at line 1451 of file mod_input_output.t.

◆ create_output_file()

subroutine mod_input_output::create_output_file ( integer, intent(out)  fh,
integer, intent(in)  ix,
character(len=*), intent(in)  extension,
character(len=*), intent(in), optional  suffix 
)

Standard method for creating a new output file.

Parameters
[out]fhFile handle
[in]ixIndex of file
[in]extensionExtension of file
[in]suffixOptional suffix

Definition at line 1148 of file mod_input_output.t.

Here is the call graph for this function:

◆ get_fields_string()

subroutine mod_input_output::get_fields_string ( character(len=*), intent(in)  line,
character(len=*), intent(in)  delims,
integer, intent(in)  n_max,
character(len=*), dimension(n_max), intent(inout)  fields,
integer, intent(inout)  n_found,
logical, intent(out), optional  fully_read 
)

Routine to find entries in a string.

Parameters
[in]lineThe line from which we want to read
[in]delimsA string with delimiters. For example delims = " ,'"""//char(9)
[in]n_maxMaximum number of entries to read in
[in,out]n_foundNumber of entries found
[in,out]fieldsFields in the strings

Definition at line 1046 of file mod_input_output.t.

◆ get_global_maxima()

subroutine mod_input_output::get_global_maxima ( double precision, dimension(nw), intent(out)  wmax)

Compute global maxima of iw variables over the leaves of the grid.

Parameters
[out]wmaxThe global maxima

Definition at line 2279 of file mod_input_output.t.

◆ get_global_minima()

subroutine mod_input_output::get_global_minima ( double precision, dimension(nw), intent(out)  wmin)

Compute global minima of iw variables over the leaves of the grid.

Parameters
[out]wminThe global maxima

Definition at line 2306 of file mod_input_output.t.

◆ get_snapshot_index()

integer function mod_input_output::get_snapshot_index ( character(len=*), intent(in)  filename)

Definition at line 1193 of file mod_input_output.t.

◆ get_volume_average()

subroutine mod_input_output::get_volume_average ( integer, intent(in)  power,
double precision, dimension(nw), intent(out)  mode,
double precision, intent(out)  volume 
)

Compute mean(w**power) over the leaves of the grid. The first mode (power=1) corresponds to the mean, the second to the mean squared values and so on.

Parameters
[in]powerWhich mode to compute
[out]modeThe computed mode
[out]volumeThe total grid volume

Definition at line 2172 of file mod_input_output.t.

◆ get_volume_average_func()

subroutine mod_input_output::get_volume_average_func (   func,
double precision, intent(out)  f_avg,
double precision, intent(out)  volume 
)

Compute the volume average of func(w) over the leaves of the grid.

Parameters
[out]f_avgThe volume average of func
[out]volumeThe total grid volume

Definition at line 2236 of file mod_input_output.t.

◆ get_volume_coverage()

subroutine mod_input_output::get_volume_coverage ( double precision, dimension(1:refine_max_level), intent(out)  vol_cov)

Compute how much of the domain is covered by each grid level. This routine does not take a non-Cartesian geometry into account.

Definition at line 2210 of file mod_input_output.t.

◆ printlog_default()

subroutine mod_input_output::printlog_default ( )

Write volume-averaged values and other information to the log file.

Definition at line 2011 of file mod_input_output.t.

Here is the call graph for this function:

◆ printlog_regression_test()

subroutine mod_input_output::printlog_regression_test ( )

Print a log that can be used to check whether the code still produces the same output (regression test)

Definition at line 2142 of file mod_input_output.t.

Here is the call graph for this function:

◆ read_arguments()

subroutine mod_input_output::read_arguments ( )

Read the command line arguments passed to amrvac.

Todo:
Document these command line options

Definition at line 25 of file mod_input_output.t.

Here is the call graph for this function:

◆ read_par_files()

subroutine mod_input_output::read_par_files ( )

Read in the user-supplied parameter-file.

Definition at line 102 of file mod_input_output.t.

Here is the call graph for this function:

◆ read_snapshot()

subroutine mod_input_output::read_snapshot ( )

Routine to read in snapshots (.dat files). When it cannot recognize the file version, it will automatically try the 'old' reader.

Definition at line 1674 of file mod_input_output.t.

Here is the call graph for this function:

◆ read_snapshot_old()

subroutine mod_input_output::read_snapshot_old ( )

Definition at line 1872 of file mod_input_output.t.

Here is the call graph for this function:

◆ saveamrfile()

subroutine mod_input_output::saveamrfile ( integer  ifile)

Definition at line 1094 of file mod_input_output.t.

Here is the call graph for this function:

◆ snapshot_exists()

logical function mod_input_output::snapshot_exists ( integer, intent(in)  ix)
Parameters
[in]ixIndex of snapshot

Definition at line 1184 of file mod_input_output.t.

◆ snapshot_read_header()

subroutine mod_input_output::snapshot_read_header ( integer, intent(in)  fh,
integer(mpi_offset_kind), intent(out)  offset_tree,
integer(mpi_offset_kind), intent(out)  offset_block 
)

Read header for a snapshot.

If you edit the header, don't forget to update: snapshot_write_header(), snapshot_read_header(), doc/fileformat.md, tools/python/dat_reader.py

Parameters
[in]fhFile handle
[out]offset_treeOffset of tree info
[out]offset_blockOffset of block data

Definition at line 1279 of file mod_input_output.t.

Here is the call graph for this function:

◆ snapshot_write_header()

subroutine mod_input_output::snapshot_write_header ( integer, intent(in)  fh,
integer(kind=mpi_offset_kind), intent(in)  offset_tree,
integer(kind=mpi_offset_kind), intent(in)  offset_block 
)

Write header for a snapshot.

If you edit the header, don't forget to update: snapshot_write_header(), snapshot_read_header(), doc/fileformat.md, tools/python/dat_reader.py

Parameters
[in]fhFile handle
[in]offset_treeOffset of tree info
[in]offset_blockOffset of block data

Definition at line 1206 of file mod_input_output.t.

◆ write_snapshot()

subroutine mod_input_output::write_snapshot ( )

Definition at line 1491 of file mod_input_output.t.

Here is the call graph for this function:

Variable Documentation

◆ compatible_versions

integer, dimension(3), parameter mod_input_output::compatible_versions = [3, 4, 5]

List of compatible versions.

Definition at line 11 of file mod_input_output.t.

◆ fmt_i

character(len=*), parameter mod_input_output::fmt_i = 'i8'

Definition at line 19 of file mod_input_output.t.

◆ fmt_r

character(len=*), parameter mod_input_output::fmt_r = 'es16.8'

Definition at line 17 of file mod_input_output.t.

◆ fmt_r2

character(len=*), parameter mod_input_output::fmt_r2 = 'es10.2'

Definition at line 18 of file mod_input_output.t.

◆ nw_found

integer mod_input_output::nw_found

number of w found in dat files

Definition at line 14 of file mod_input_output.t.

◆ version_number

integer, parameter mod_input_output::version_number = 5

Version number of the .dat file output.

Definition at line 8 of file mod_input_output.t.