state_template_m Module

Holds current state and handles its I/O via netcdf


Used by


Contents


Variables

Type Visibility Attributes Name Initial
integer, public :: tstep

Current time-step of state

real(kind=GP), public :: tau

Current time of state

integer, protected :: isnaps = 0

Current snapshot number

integer, protected :: np_max

Maximum number of points per plane, across all planes and stag/cano

real(kind=GP), public, allocatable, dimension(:), target :: dens

Density

real(kind=GP), public, allocatable, dimension(:) :: parmom

Parallel momentum

real(kind=GP), public, allocatable, dimension(:) :: upar

Parallel ion velocity Derived field: upar = parmom / dens (on staggered mesh)

real(kind=GP), public, allocatable, dimension(:) :: pion

Ion pressure

real(kind=GP), public, allocatable, dimension(:) :: tion

Ion temperature Derived field: tion = pion / dens


Interfaces

interface

  • public module subroutine write_template_state_netcdf(comm_handler, dirname, filename)

    Writes state to netcdf file If filename is not present, it increases isnaps by one and writes to snaps_<isnaps>.nc If filename is present, it writes to filename, without increasing isnaps. This is useful for writing e.g. error states

    Arguments

    Type IntentOptional Attributes Name
    type(comm_handler_t), intent(in) :: comm_handler

    Communication handler

    character(len=*), intent(in), optional :: dirname

    Directory, where snapshots files will be written

    character(len=*), intent(in), optional :: filename

    Filename, where state is written. The filename excludes the directory name, i.e. the final path is dirname/filename

interface

  • public module subroutine read_template_state_netcdf(comm_handler, dirname, filename)

    Reads state from netcdf file If filename is not present, it reads last from snaps_<isnaps>.nc with last available isnaps and sets isnaps to this value If filename is present it reads from this file and sets isnaps to 0

    Arguments

    Type IntentOptional Attributes Name
    type(comm_handler_t), intent(in) :: comm_handler

    Communication handler

    character(len=*), intent(in), optional :: dirname

    Directory, where snapshots files will be read

    character(len=*), intent(in), optional :: filename

    Filename, where state is read. The filename excludes the directory name, i.e. the final path is dirname/filename


Subroutines

public subroutine alloc_state_template(comm_handler)

Allocates memory for state fields

Arguments

Type IntentOptional Attributes Name
type(comm_handler_t), intent(in) :: comm_handler

Communication handler

public subroutine update_derived_fields(comm_handler)

Updates derived fields upar = parmom /dens_(stag) tion = pion / dens_(cano)

Arguments

Type IntentOptional Attributes Name
type(comm_handler_t), intent(in) :: comm_handler

Communication handler