file_io

moment_kinetics.file_io.append_to_dynamic_varFunction
append_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).

source
moment_kinetics.file_io.create_dynamic_variable!Function
create_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.

source
moment_kinetics.file_io.write_Dict_to_sectionMethod
write_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.

source
moment_kinetics.file_io.write_debug_data_to_binaryMethod
write_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).

source
moment_kinetics.file_io.write_electron_stateMethod
write_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.

source
moment_kinetics.file_io.write_single_value!Function
write_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.

source