file_io
moment_kinetics.file_io — Modulemoment_kinetics.file_io.ascii_ios — Typestructure containing the various input/output streams
moment_kinetics.file_io.io_dfns_info — Typestructure containing the data/metadata needed for binary file i/o distribution function data only
moment_kinetics.file_io.io_initial_electron_info — Typestructure containing the data/metadata needed for binary file i/o for electron initialization
moment_kinetics.file_io.io_input_struct — TypeContainer for I/O settings
moment_kinetics.file_io.io_moments_info — Typestructure containing the data/metadata needed for binary file i/o moments & fields only
moment_kinetics.file_io.add_attribute! — FunctionAdd an attribute to a file, group or variable
moment_kinetics.file_io.append_to_dynamic_var — Functionappend_to_dynamic_var(io_var, data, t_idx, parallel_io, coords...; only_root=false)Append data to the dynamic variable io_var. The time-index of the data being appended is t_idx. parallel_io indicates whether parallel I/O is being used. coords... is used to get the ranges to write from/to (needed for parallel I/O) - the entries in the coords tuple can be either coordinate instances or integers (for an integer n the range is 1:n).
If only_root=true is passed, the data is only written once - from the global root process if parallel I/O is being used (if parallel I/O is not used, this has no effect as each file is only written by one process).
moment_kinetics.file_io.check_io_implementation — Methodcheck_io_implementation(binary_format)Check that an implementation is available for binary_format, raising an error if not.
moment_kinetics.file_io.create_dynamic_variable! — Functioncreate_dynamic_variable!(file_or_group, name, type,
coords::Union{coordinate,NamedTuple}...; parallel_io,
description=nothing, units=nothing)Create a time-evolving variable in file_or_group named name of type type.
coords are the coordinates corresponding to the dimensions of the array, in the order of the array dimensions - they may be either coordinate structs or NamedTuples that contain at least the fields name, n.
A description and/or units can be added with the keyword arguments.
parallel_io is a Bool specifying whether parallel I/O is being used.
moment_kinetics.file_io.define_dynamic_dfn_variables! — Methoddefine dynamic (time-evolving) distribution function variables for writing to the output file
moment_kinetics.file_io.define_dynamic_electron_moment_variables! — Functiondefine dynamic (time-evolving) electron moment variables for writing to the hdf5 file
moment_kinetics.file_io.define_dynamic_em_field_variables! — Methoddefine dynamic (time-evolving) electromagnetic field variables for writing to the hdf5 file
moment_kinetics.file_io.define_dynamic_ion_moment_variables! — Methoddefine dynamic (time-evolving) ion moment variables for writing to the hdf5 file
moment_kinetics.file_io.define_dynamic_moment_variables! — Methoddefine dynamic (time-evolving) moment variables for writing to the hdf5 file
moment_kinetics.file_io.define_dynamic_neutral_moment_variables! — Methoddefine dynamic (time-evolving) neutral moment variables for writing to the hdf5 file
moment_kinetics.file_io.define_io_coordinate! — Methoddefine a sub-group for each code coordinate and write to output file
moment_kinetics.file_io.define_io_coordinates! — MethodDefine coords group for coordinate information in the output file and write information about spatial and velocity space coordinate grids
moment_kinetics.file_io.finish_electron_io — Methodclose output files for electron initialization
moment_kinetics.file_io.finish_file_io — Methodclose all opened output files
moment_kinetics.file_io.get_electron_io_info — MethodGet the file_info for an existing electron I/O file
moment_kinetics.file_io.get_group — FunctionGet a (sub-)group from a file or group
moment_kinetics.file_io.get_subgroup_keys — FunctionGet names of all subgroups
moment_kinetics.file_io.get_variable_keys — FunctionGet names of all variables
moment_kinetics.file_io.hdf5_get_dynamic_dim_sizes — Methodgiven a tuple, fixed_coords, containing all dimensions except the time dimension, get the dimension sizes and chunk sizes
moment_kinetics.file_io.hdf5_get_fixed_dim_sizes — MethodGet sizes of fixed dimensions and chunks (i.e. everything but time) for I/O
coords should be a tuple whose elements are coordinate structs or integers (e.g. number of species).
moment_kinetics.file_io.input_option_error — Methodaccepts an option name which has been identified as problematic and returns an appropriate error message
moment_kinetics.file_io.io_has_parallel — Functionio_has_parallel(Val(binary_format))Test if the backend supports parallel I/O.
binary_format should be one of the values of the binary_format_type enum
moment_kinetics.file_io.is_group — FunctionTest if a member of a (sub-)group is a group
moment_kinetics.file_io.modify_attribute! — FunctionModify an attribute to a file, group or variable
moment_kinetics.file_io.open_ascii_output_file — Methodopens an output file with the requested prefix and extension and returns the corresponding io stream (identifier)
moment_kinetics.file_io.open_output_file — MethodOpen an output file, selecting the backend based on io_option
moment_kinetics.file_io.open_output_file_implementation — FunctionLow-level function to open a binary output file
Each implementation (HDF5, NetCDF, etc.) defines a method of this function to open a file of the corresponding type.
moment_kinetics.file_io.reopen_dfns_io — MethodReopen an existing distribution-functions output file to append more data
moment_kinetics.file_io.reopen_initial_electron_io — MethodReopen an existing initial electron output file to append more data
moment_kinetics.file_io.reopen_moments_io — MethodReopen an existing moments output file to append more data
moment_kinetics.file_io.reopen_output_file — MethodRe-open an existing output file, selecting the backend based on io_option
moment_kinetics.file_io.setup_dfns_io — Methodsetup file i/o for distribution function variables
moment_kinetics.file_io.setup_electron_io — Methodopen output file to save the initial electron pressure and distribution function
moment_kinetics.file_io.setup_file_io — Methodopen the necessary output files
moment_kinetics.file_io.setup_io_input — MethodRead the settings for I/O
moment_kinetics.file_io.setup_moments_io — Methodsetup file i/o for moment variables
moment_kinetics.file_io.write_Dict_to_section — Methodwrite_Dict_to_section(section_io, section_dict, parallel_io)Write the contents of section_dict into the I/O group section_io.
Any nested Dicts in section_dict are written to subsections.
All the keys in section_dict (and any nested Dicts) should be Strings.
parallel_io is a Bool indicating whether parallel I/O is being used.
moment_kinetics.file_io.write_all_dfns_data_to_binary — Methodwrite time-dependent distribution function data for ions, electrons and neutrals to the binary output file
moment_kinetics.file_io.write_all_moments_data_to_binary — Functionwrite time-dependent moments data for ions, electrons and neutrals to the binary output file
moment_kinetics.file_io.write_data_to_ascii — Methodmoment_kinetics.file_io.write_debug_data_to_binary — Methodwrite_debug_data_to_binary(this_scratch, moments, fields, composition, t_params,
r, z, vperp, vpa, vzeta, vr, vz, label, istage)If t_params.debug_io represents an output file (rather than being nothing), write the state contained in this_scratch, moments, and fields to that output file. label is a String identifying the location this function was called from (for reference when debugging). istage should be the Runge-Kutta stage that this function was called from (when called from within the loop over Runge-Kutta stages).
moment_kinetics.file_io.write_electron_dfns_data_to_binary — Functionwrite time-dependent distribution function data for electrons to the binary output file
Note: should only be called from within a function that (re-)opens the output file.
moment_kinetics.file_io.write_electron_moments_data_to_binary — Functionwrite time-dependent moments data for electrons to the binary output file
Note: should only be called from within a function that (re-)opens the output file.
moment_kinetics.file_io.write_electron_state — Methodwrite_electron_state(scratch_electron, moments, t_params, io_initial_electron,
t_idx, local_pseudotime, electron_residual, r, z, vperp, vpa;
pdf_electron_converged=false)Write the electron state to an output file.
moment_kinetics.file_io.write_em_fields_data_to_binary — Methodwrite time-dependent EM fields data to the binary output file
Note: should only be called from within a function that (re-)opens the output file.
moment_kinetics.file_io.write_f_ascii — Methodwrite the function f(z,vpa) at this time slice
moment_kinetics.file_io.write_fields_ascii — Methodwrite electrostatic potential at this time slice
moment_kinetics.file_io.write_final_timing_data_to_binary — Methodwrite_final_timing_data_to_binary(io_or_file_info_moments)Write the timing data in moment_kinetics.timer_utils.global_timer to the output file. Needs to be called after exiting from the @timeit block so that all timers are finalised properly.
moment_kinetics.file_io.write_input! — MethodSave info from the dict with input settings to the output file
Note: assumes all keys in input_dict are strings.
moment_kinetics.file_io.write_ion_dfns_data_to_binary — Methodwrite time-dependent distribution function data for ions to the binary output file
Note: should only be called from within a function that (re-)opens the output file.
moment_kinetics.file_io.write_ion_moments_data_to_binary — Methodwrite time-dependent moments data for ions to the binary output file
Note: should only be called from within a function that (re-)opens the output file.
moment_kinetics.file_io.write_manufactured_solutions! — MethodWrite time-independent information about manufactured solutions
moment_kinetics.file_io.write_moments_electron_ascii — Methodwrite moments of the ion species distribution function f at this time slice
moment_kinetics.file_io.write_moments_ion_ascii — Methodwrite moments of the ion species distribution function f at this time slice
moment_kinetics.file_io.write_moments_neutral_ascii — Methodwrite moments of the neutral species distribution function f_neutral at this time slice
moment_kinetics.file_io.write_neutral_dfns_data_to_binary — Methodwrite time-dependent distribution function data for neutrals to the binary output file
Note: should only be called from within a function that (re-)opens the output file.
moment_kinetics.file_io.write_neutral_moments_data_to_binary — Methodwrite time-dependent moments data for neutrals to the binary output file
Note: should only be called from within a function that (re-)opens the output file.
moment_kinetics.file_io.write_overview! — Methodwrite some overview information for the simulation to the binary file
moment_kinetics.file_io.write_provenance_tracking_info! — MethodWrite provenance tracking information, to allow runs to be reproduced.
moment_kinetics.file_io.write_single_value! — Functionwrite_single_value!(file_or_group, name,
data::Union{Number, AbstractString, AbstractArray{T,N}},
coords::Union{coordinate,mk_int,NamedTuple}...; parallel_io,
description=nothing, units=nothing,
overwrite=false) where {T,N}Write a single variable to a file or group. If a description or units are passed, add as attributes of the variable.
If overwrite=true is passed, overwrite the variable if it already exists in the file. Note that when overwriting a String variable, the new String must have exactly the same length as the original String.