snapshot_m Module

Writing and reading snapshot files



Contents


Derived Types

type, public ::  char_arr_t

Can be used for character arrays of variable length

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: str

String

type, public ::  snapshot_t

Datatype for snapshout I/O

Finalizations Procedures

final :: destructor

Type-Bound Procedures

procedure , public :: init => init_snapshot Subroutine
procedure , public :: write_snaps Subroutine
procedure , public :: read_snaps Subroutine
procedure , public :: read_snaps_last Subroutine
procedure , public :: display => display_snapshot Subroutine

Subroutines

public subroutine init_snapshot(self, comm_handler, mesh_cano, mesh_stag, dirpath, nvars, name_vars)

Initialises snapshots, creates dirpath

Arguments

Type IntentOptional Attributes Name
class(snapshot_t), intent(inout) :: self

Instance of the type

type(comm_handler_t), intent(in) :: comm_handler

MPI communicator

type(mesh_cart_t), intent(in) :: mesh_cano

Mesh (canonical)

type(mesh_cart_t), intent(in) :: mesh_stag

Mesh (staggered)

character(len=*), intent(in) :: dirpath

Directory, where snapshot files are written

integer, intent(in) :: nvars

Number of variables to be written

type(char_arr_t), intent(in), dimension(nvars) :: name_vars

Names of variables

public subroutine write_snaps(self, comm_handler, isnaps, tau, vars, isubsnaps, allow_overwrite)

Writes snapshot

Arguments

Type IntentOptional Attributes Name
class(snapshot_t), intent(in) :: self

Instance of the type

type(comm_handler_t), intent(in) :: comm_handler

MPI communicator

integer, intent(in) :: isnaps

Snapshot number

real(kind=GP), intent(in) :: tau

Time

type(variable_t), intent(in), dimension(self%nvars) :: vars

Variables

integer, intent(in), optional :: isubsnaps

Optional sub-snapshot number

logical, intent(in), optional :: allow_overwrite

Whether to allow overwriting snapfiles

public subroutine read_snaps_last(self, comm_handler, isnaps, tau, vars)

Reads last available snapshot

Arguments

Type IntentOptional Attributes Name
class(snapshot_t), intent(in) :: self

Instance of the type

type(comm_handler_t), intent(in) :: comm_handler

MPI communicator

integer, intent(out) :: isnaps

Snapshot number

real(kind=GP), intent(out) :: tau

Time

type(variable_t), intent(inout), dimension(self%nvars) :: vars

Variables

public subroutine read_snaps(self, comm_handler, isnaps, tau, vars)

Reads snapshot

Arguments

Type IntentOptional Attributes Name
class(snapshot_t), intent(in) :: self

Instance of the type

type(comm_handler_t), intent(in) :: comm_handler

MPI communicator

integer, intent(in) :: isnaps

Snapshot number

real(kind=GP), intent(out) :: tau

Time

type(variable_t), intent(inout), dimension(self%nvars) :: vars

Variables

public subroutine display_snapshot(self)

Displays information

Arguments

Type IntentOptional Attributes Name
class(snapshot_t), intent(inout) :: self

Instance of the type

public subroutine destructor(self)

Destructor

Arguments

Type IntentOptional Attributes Name
type(snapshot_t), intent(inout) :: self

Instance of the type